张善主

fix(17088): 功能缺陷-【生产环境】播放暂停按钮-未自动隐藏--暂停不隐藏, 播放是4秒隐藏

... ... @@ -7,12 +7,15 @@ import { ContentDetailDTO, LiveRoomDataBean } from 'wdBean/Index';
import { DisplayDirection } from 'wdConstant/Index';
import { LiveFollowComponent, LottieView } from 'wdComponent/Index';
import { WDShare } from 'wdShare/Index';
import { faceDetector } from '@kit.CoreVisionKit';
//直播间播放器上层覆盖物
@Component
export struct PlayUIComponent {
playerController?: WDAliPlayerController;
//菜单键是否可见
@State @Watch('onChangeMenuVisible') isMenuVisible: boolean = true
private ispause:boolean = false
@Consume contentDetailData: ContentDetailDTO
@Consume liveRoomDataBean: LiveRoomDataBean
@State currentTime: string = ''
... ... @@ -35,8 +38,11 @@ export struct PlayUIComponent {
let time: number = 0
if (this.isMenuVisible) {
setTimeout(() => {
if(this.ispause){
return
}
this.isMenuVisible = false
}, 5 * 1000)
}, 4 * 1000)
} else {
clearTimeout(time)
}
... ... @@ -46,6 +52,16 @@ export struct PlayUIComponent {
this.onChangeMenuVisible()
this.initPlayerSet()
if(this.playerController){
this.playerController.onStatusChangeForPlayUIComponent = (status: number) => {
if(1 == status){
this.ispause = false
this.isMenuVisible = false
}else if(2 == status){
this.ispause = true
}
}
}
}
aboutToDisappear(): void {
... ... @@ -271,6 +287,9 @@ export struct PlayUIComponent {
if (this.contentDetailData?.liveInfo?.liveState === 'wait') {
return
}
if(this.ispause){
return
}
this.isMenuVisible = !this.isMenuVisible
})
}
... ...
... ... @@ -60,6 +60,7 @@ export class WDAliPlayerController {
// 准备完成,决定是否播放回调。如果不实现,则自动播放
public onCanplay?: () => void;
public onStatusChange?: (status: number) => void;
public onStatusChangeForPlayUIComponent?: (status: number) => void;
public onFirstFrameDisplay?: () => void
// 埋点字段
private creatStartTime: number = 0; //开始加载时间
... ... @@ -513,6 +514,9 @@ export class WDAliPlayerController {
if (this.onStatusChange) {
this.onStatusChange(this.status)
}
if(this.onStatusChangeForPlayUIComponent){
this.onStatusChangeForPlayUIComponent(this.status)
}
}
... ...