PlayerInfoComponent.ets
1.27 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
import { WDAliPlayerController } from 'wdPlayer/Index'
import { PlayerUIComponent } from './PlayerUIComponent'
//竖屏直播详情页左右滑动浮层
@Component
export struct PlayerInfoComponent {
swiperController?: SwiperController
private playerController?: WDAliPlayerController
@Consume bottomSafeHeight: number
@Consume topSafeHeight: number
@Consume liveState: string
@Consume isShowControl: boolean
@Link swiperIndex: number
@Provide isFullScreen: boolean = false // 判断是否全屏,全屏状态下swiper禁止切换
build() {
Column() {
Swiper(this.swiperController) {
Text('')
PlayerUIComponent({ playerController: this.playerController })
.margin({
// bottom: this.bottomSafeHeight + 'px',
top: this.topSafeHeight + 'px'
})
}
.cachedCount(2)
.indicator(false)
.effectMode(EdgeEffect.None)
.loop(false)
.width('100%')
.height('100%')
.index(this.swiperIndex)
.onClick(() => {
if (this.liveState === 'end') {
this.isShowControl = !this.isShowControl
}
})
.onChange((index) => {
this.swiperIndex = index
})
.disableSwipe(this.isFullScreen)
}
.height('100%')
.width('100%')
}
}