Showing
2 changed files
with
24 additions
and
1 deletions
| @@ -7,12 +7,15 @@ import { ContentDetailDTO, LiveRoomDataBean } from 'wdBean/Index'; | @@ -7,12 +7,15 @@ import { ContentDetailDTO, LiveRoomDataBean } from 'wdBean/Index'; | ||
| 7 | import { DisplayDirection } from 'wdConstant/Index'; | 7 | import { DisplayDirection } from 'wdConstant/Index'; |
| 8 | import { LiveFollowComponent, LottieView } from 'wdComponent/Index'; | 8 | import { LiveFollowComponent, LottieView } from 'wdComponent/Index'; |
| 9 | import { WDShare } from 'wdShare/Index'; | 9 | import { WDShare } from 'wdShare/Index'; |
| 10 | +import { faceDetector } from '@kit.CoreVisionKit'; | ||
| 11 | + | ||
| 10 | //直播间播放器上层覆盖物 | 12 | //直播间播放器上层覆盖物 |
| 11 | @Component | 13 | @Component |
| 12 | export struct PlayUIComponent { | 14 | export struct PlayUIComponent { |
| 13 | playerController?: WDAliPlayerController; | 15 | playerController?: WDAliPlayerController; |
| 14 | //菜单键是否可见 | 16 | //菜单键是否可见 |
| 15 | @State @Watch('onChangeMenuVisible') isMenuVisible: boolean = true | 17 | @State @Watch('onChangeMenuVisible') isMenuVisible: boolean = true |
| 18 | + private ispause:boolean = false | ||
| 16 | @Consume contentDetailData: ContentDetailDTO | 19 | @Consume contentDetailData: ContentDetailDTO |
| 17 | @Consume liveRoomDataBean: LiveRoomDataBean | 20 | @Consume liveRoomDataBean: LiveRoomDataBean |
| 18 | @State currentTime: string = '' | 21 | @State currentTime: string = '' |
| @@ -35,8 +38,11 @@ export struct PlayUIComponent { | @@ -35,8 +38,11 @@ export struct PlayUIComponent { | ||
| 35 | let time: number = 0 | 38 | let time: number = 0 |
| 36 | if (this.isMenuVisible) { | 39 | if (this.isMenuVisible) { |
| 37 | setTimeout(() => { | 40 | setTimeout(() => { |
| 41 | + if(this.ispause){ | ||
| 42 | + return | ||
| 43 | + } | ||
| 38 | this.isMenuVisible = false | 44 | this.isMenuVisible = false |
| 39 | - }, 5 * 1000) | 45 | + }, 4 * 1000) |
| 40 | } else { | 46 | } else { |
| 41 | clearTimeout(time) | 47 | clearTimeout(time) |
| 42 | } | 48 | } |
| @@ -46,6 +52,16 @@ export struct PlayUIComponent { | @@ -46,6 +52,16 @@ export struct PlayUIComponent { | ||
| 46 | this.onChangeMenuVisible() | 52 | this.onChangeMenuVisible() |
| 47 | 53 | ||
| 48 | this.initPlayerSet() | 54 | this.initPlayerSet() |
| 55 | + if(this.playerController){ | ||
| 56 | + this.playerController.onStatusChangeForPlayUIComponent = (status: number) => { | ||
| 57 | + if(1 == status){ | ||
| 58 | + this.ispause = false | ||
| 59 | + this.isMenuVisible = false | ||
| 60 | + }else if(2 == status){ | ||
| 61 | + this.ispause = true | ||
| 62 | + } | ||
| 63 | + } | ||
| 64 | + } | ||
| 49 | } | 65 | } |
| 50 | 66 | ||
| 51 | aboutToDisappear(): void { | 67 | aboutToDisappear(): void { |
| @@ -271,6 +287,9 @@ export struct PlayUIComponent { | @@ -271,6 +287,9 @@ export struct PlayUIComponent { | ||
| 271 | if (this.contentDetailData?.liveInfo?.liveState === 'wait') { | 287 | if (this.contentDetailData?.liveInfo?.liveState === 'wait') { |
| 272 | return | 288 | return |
| 273 | } | 289 | } |
| 290 | + if(this.ispause){ | ||
| 291 | + return | ||
| 292 | + } | ||
| 274 | this.isMenuVisible = !this.isMenuVisible | 293 | this.isMenuVisible = !this.isMenuVisible |
| 275 | }) | 294 | }) |
| 276 | } | 295 | } |
| @@ -60,6 +60,7 @@ export class WDAliPlayerController { | @@ -60,6 +60,7 @@ export class WDAliPlayerController { | ||
| 60 | // 准备完成,决定是否播放回调。如果不实现,则自动播放 | 60 | // 准备完成,决定是否播放回调。如果不实现,则自动播放 |
| 61 | public onCanplay?: () => void; | 61 | public onCanplay?: () => void; |
| 62 | public onStatusChange?: (status: number) => void; | 62 | public onStatusChange?: (status: number) => void; |
| 63 | + public onStatusChangeForPlayUIComponent?: (status: number) => void; | ||
| 63 | public onFirstFrameDisplay?: () => void | 64 | public onFirstFrameDisplay?: () => void |
| 64 | // 埋点字段 | 65 | // 埋点字段 |
| 65 | private creatStartTime: number = 0; //开始加载时间 | 66 | private creatStartTime: number = 0; //开始加载时间 |
| @@ -513,6 +514,9 @@ export class WDAliPlayerController { | @@ -513,6 +514,9 @@ export class WDAliPlayerController { | ||
| 513 | if (this.onStatusChange) { | 514 | if (this.onStatusChange) { |
| 514 | this.onStatusChange(this.status) | 515 | this.onStatusChange(this.status) |
| 515 | } | 516 | } |
| 517 | + if(this.onStatusChangeForPlayUIComponent){ | ||
| 518 | + this.onStatusChangeForPlayUIComponent(this.status) | ||
| 519 | + } | ||
| 516 | 520 | ||
| 517 | } | 521 | } |
| 518 | 522 |
-
Please register or login to post a comment