wuyanan

手动暂停直播后,app进入后台后,在回到前台场景,不自动恢复播放,和 iOS 保持一致

@@ -30,8 +30,9 @@ export struct PlayUIComponent { @@ -30,8 +30,9 @@ export struct PlayUIComponent {
30 // 当前播放资源的状态 30 // 当前播放资源的状态
31 @Consume playSourceState: number 31 @Consume playSourceState: number
32 32
  33 + manualClickPauseOrPlayBack?:(manualClickPauseOrPlay: boolean) => void
  34 +
33 onChangeMenuVisible() { 35 onChangeMenuVisible() {
34 - this.isPlayStatus = !this.isPlayStatus  
35 if (!this.contentDetailData || !this.contentDetailData.liveInfo || 36 if (!this.contentDetailData || !this.contentDetailData.liveInfo ||
36 this.contentDetailData?.liveInfo?.liveState === 'wait') { 37 this.contentDetailData?.liveInfo?.liveState === 'wait') {
37 return 38 return
@@ -398,12 +399,18 @@ export struct PlayUIComponent { @@ -398,12 +399,18 @@ export struct PlayUIComponent {
398 if (this.isPlayStatus) { 399 if (this.isPlayStatus) {
399 this.isPlayStatus = false 400 this.isPlayStatus = false
400 this.playerController?.pause() 401 this.playerController?.pause()
  402 + if (this.manualClickPauseOrPlayBack) {
  403 + this.manualClickPauseOrPlayBack(true)
  404 + }
401 } else { 405 } else {
402 this.isPlayStatus = true 406 this.isPlayStatus = true
403 if (this.contentDetailData.liveInfo?.liveState == 'running') { 407 if (this.contentDetailData.liveInfo?.liveState == 'running') {
404 this.playerController?.firstPlay(this.liveUrl) 408 this.playerController?.firstPlay(this.liveUrl)
405 } 409 }
406 this.playerController?.play() 410 this.playerController?.play()
  411 + if (this.manualClickPauseOrPlayBack) {
  412 + this.manualClickPauseOrPlayBack(false)
  413 + }
407 } 414 }
408 }) 415 })
409 } 416 }
@@ -40,7 +40,13 @@ export struct TopPlayComponent { @@ -40,7 +40,13 @@ export struct TopPlayComponent {
40 @Consume @Watch('pageHideChange') pageHide: number 40 @Consume @Watch('pageHideChange') pageHide: number
41 init: boolean = false 41 init: boolean = false
42 @Prop @Watch("liveIMControlMessageChange") lastLiveControl: LiveRoomItemBean = {} as LiveRoomItemBean // IM 控制消息 42 @Prop @Watch("liveIMControlMessageChange") lastLiveControl: LiveRoomItemBean = {} as LiveRoomItemBean // IM 控制消息
  43 + ///是否是手动点击暂停,手动暂停的,页面重新出现时,不自动恢复播放
  44 + manualClickPauseOrPlay: boolean = false
43 pageShowChange() { 45 pageShowChange() {
  46 + if (this.manualClickPauseOrPlay) {
  47 + return
  48 + }
  49 +
44 this.playerController?.play() 50 this.playerController?.play()
45 } 51 }
46 52
@@ -263,7 +269,9 @@ export struct TopPlayComponent { @@ -263,7 +269,9 @@ export struct TopPlayComponent {
263 PictureLoading().visibility(this.isHideLoading ? Visibility.None : Visibility.Visible) 269 PictureLoading().visibility(this.isHideLoading ? Visibility.None : Visibility.Visible)
264 270
265 // 视频播放器上的控制面板和信息 271 // 视频播放器上的控制面板和信息
266 - PlayUIComponent({ playerController: this.playerController, isShowBottom: this.isCanPlay, liveUrl: this.playUrl }) 272 + PlayUIComponent({ playerController: this.playerController, isShowBottom: this.isCanPlay, liveUrl: this.playUrl,manualClickPauseOrPlayBack:(manualClickPauseOrPlay: boolean) => {
  273 + this.manualClickPauseOrPlay = manualClickPauseOrPlay;
  274 + }})
267 275
268 // 直播结束 276 // 直播结束
269 Text('直播已结束') 277 Text('直播已结束')