wuyanan

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

... ... @@ -30,8 +30,9 @@ export struct PlayUIComponent {
// 当前播放资源的状态
@Consume playSourceState: number
manualClickPauseOrPlayBack?:(manualClickPauseOrPlay: boolean) => void
onChangeMenuVisible() {
this.isPlayStatus = !this.isPlayStatus
if (!this.contentDetailData || !this.contentDetailData.liveInfo ||
this.contentDetailData?.liveInfo?.liveState === 'wait') {
return
... ... @@ -398,12 +399,18 @@ export struct PlayUIComponent {
if (this.isPlayStatus) {
this.isPlayStatus = false
this.playerController?.pause()
if (this.manualClickPauseOrPlayBack) {
this.manualClickPauseOrPlayBack(true)
}
} else {
this.isPlayStatus = true
if (this.contentDetailData.liveInfo?.liveState == 'running') {
this.playerController?.firstPlay(this.liveUrl)
}
this.playerController?.play()
if (this.manualClickPauseOrPlayBack) {
this.manualClickPauseOrPlayBack(false)
}
}
})
}
... ...
... ... @@ -40,7 +40,13 @@ export struct TopPlayComponent {
@Consume @Watch('pageHideChange') pageHide: number
init: boolean = false
@Prop @Watch("liveIMControlMessageChange") lastLiveControl: LiveRoomItemBean = {} as LiveRoomItemBean // IM 控制消息
///是否是手动点击暂停,手动暂停的,页面重新出现时,不自动恢复播放
manualClickPauseOrPlay: boolean = false
pageShowChange() {
if (this.manualClickPauseOrPlay) {
return
}
this.playerController?.play()
}
... ... @@ -263,7 +269,9 @@ export struct TopPlayComponent {
PictureLoading().visibility(this.isHideLoading ? Visibility.None : Visibility.Visible)
// 视频播放器上的控制面板和信息
PlayUIComponent({ playerController: this.playerController, isShowBottom: this.isCanPlay, liveUrl: this.playUrl })
PlayUIComponent({ playerController: this.playerController, isShowBottom: this.isCanPlay, liveUrl: this.playUrl,manualClickPauseOrPlayBack:(manualClickPauseOrPlay: boolean) => {
this.manualClickPauseOrPlay = manualClickPauseOrPlay;
}})
// 直播结束
Text('直播已结束')
... ...