PlayerDetailContainer.ets
1.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/**
* 详情view&播放器view的容器布局组件
*/
@Component
export struct PlayerDetailContainer {
@BuilderParam playerView: () => void
@BuilderParam playControlView: () => void
@BuilderParam detailView: () => void
@Consume isFullScreen: boolean
@Consume videoLandScape?: number // 视频朝向, 横屏视频:1;竖屏视频:2
aboutToAppear() {
console.log(`PlayerDetailContainer aboutToAppear`)
}
buildVideoHeight() {
let videoHeight: string | number = 200
if (this.videoLandScape == 2) {
videoHeight = '100%'
} else {
videoHeight = 200
}
console.log(`PlayerDetailContainer buildVideoHeight:${videoHeight} `)
return videoHeight
}
buildVideoTo() {
let videoTop: number;
if (this.videoLandScape == 2) {
videoTop = 0
} else {
videoTop = 174
}
console.log(`PlayerDetailContainer videoTop:${videoTop} `)
return videoTop
}
buildVideoBottom() {
let videoBottom: number;
if (this.videoLandScape == 2) {
videoBottom = 0
} else {
videoBottom = 320
}
console.log(`PlayerDetailContainer buildVideoBottom:${videoBottom} `)
return videoBottom
}
isShowBottomView() {
console.log(`PlayerDetailContainer videoLandScape:${this.videoLandScape} `)
let isShowBottom: boolean = false
if (this.isFullScreen) {
isShowBottom = false
} else {
isShowBottom = true
}
console.log(`PlayerDetailContainer isShowBottom:${isShowBottom} `)
return isShowBottom
}
build() {
Stack() {
this.playerView()
this.detailView()
}
.width('100%')
.height('100%')
// .backgroundColor(Color.Black) // 扩展至所有非安全区域
// .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM])
}
}