1/*
2 * Copyright (c) 2024 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16const TAG = 'avcastpicker_component ';
17
18@Component
19export struct AVCastPicker {
20
21  /**
22   * Custom builder from application
23   */
24  @BuilderParam customPicker: (() => void)
25
26  build() {
27    Column() {
28      if (this.customPicker === undefined) {
29        this.buildDefaultPicker();
30      } else {
31        this.buildCustomPicker();
32      }
33    }
34    .size({width: '100%', height: '100%'})
35  }
36
37  @Builder
38  private buildDefaultPicker() {
39    Column() {
40      Button() {
41        Image($r('sys.media.ohos_ic_public_cast_stream'))
42        .size({width: '100%', height: '100%'})
43        .draggable(false)
44      }
45      .type(ButtonType.Circle)
46      .backgroundColor('#00000000')
47      .size({width: '100%', height: '100%'})
48    }
49    .size({width: '100%', height: '100%'})
50  }
51
52  @Builder
53  private buildCustomPicker() {
54    Column() {
55      Button() {
56        this.customPicker();
57      }
58      .type(ButtonType.Circle)
59      .backgroundColor('#00000000')
60      .size({width: '100%', height: '100%'})
61    }
62    .size({width: '100%', height: '100%'})
63  }
64}