zhenghy

修复直播频道切换问题

... ... @@ -5,6 +5,8 @@ import router from '@ohos.router';
import { DetailPlayLivePage } from './DetailPlayLivePage'
import { DetailPlayVLivePage } from './DetailPlayVLivePage'
const TAG = 'DetailPlayLiveCommon'
@Entry()
@Component
export struct DetailPlayLiveCommon {
... ... @@ -47,7 +49,7 @@ export struct DetailPlayLiveCommon {
this.liveDetailsBean = data[0]
this.liveState = this.liveDetailsBean.liveInfo?.liveState
this.liveStyle = this.liveDetailsBean.liveInfo.liveStyle
console.error('liveDetailsBean===', JSON.stringify((this.liveDetailsBean)))
console.log(TAG, 'getLiveDetails:', JSON.stringify((this.liveDetailsBean)))
}
},
() => {
... ...
... ... @@ -8,11 +8,11 @@ import { WDPlayerController } from 'wdPlayer/Index';
import { DisplayDirection } from 'wdConstant/Index';
const storage = LocalStorage.getShared();
const TAG = 'DetailPlayVLivePage'
@Entry(storage)
@Component
export struct DetailPlayVLivePage {
TAG: string = 'DetailPlayVLivePage';
private liveViewModel: LiveViewModel = new LiveViewModel()
private playerController: WDPlayerController = new WDPlayerController();
private swiperController: SwiperController = new SwiperController()
... ... @@ -29,6 +29,7 @@ export struct DetailPlayVLivePage {
@State swiperIndex: number = 1
aboutToAppear(): void {
console.log(TAG, 'aboutToAppear')
WindowModel.shared.setWindowLayoutFullScreen(true)
WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#ffffff', })
... ... @@ -86,11 +87,11 @@ export struct DetailPlayVLivePage {
if (data.length > 0) {
this.liveDetailsBean = data[0]
this.liveState = this.liveDetailsBean.liveInfo?.liveState
console.error('liveDetailsBean===', JSON.stringify((this.liveDetailsBean)))
console.log(TAG, 'getLiveDetails', JSON.stringify((this.liveDetailsBean)))
}
},
() => {
(message: string) => {
console.error(TAG, 'getLiveDetails catch', message)
})
}
... ... @@ -99,9 +100,10 @@ export struct DetailPlayVLivePage {
.then(
(data) => {
this.liveRoomDataBean = data
console.log(TAG, 'getLiveRoomData', JSON.stringify((this.liveRoomDataBean)))
},
() => {
(message: string) => {
console.error(TAG, 'getLiveDetails catch', message)
})
}
}
... ...
... ... @@ -2,6 +2,7 @@ import { LiveDetailsBean } from 'wdBean/Index';
import { WDPlayerController, WDPlayerRenderVLiveView, WDPlayerRenderView } from 'wdPlayer/Index';
import componentUtils from '@ohos.arkui.componentUtils';
const TAG = 'PlayerComponent'
@Component
export struct PlayerComponent {
... ... @@ -16,6 +17,7 @@ export struct PlayerComponent {
@State playUrl: string = ''
aboutToAppear(): void {
console.log(TAG, 'aboutToAppear')
if (this.playerController) {
this.playerController.onCanplay = () => {
console.log('可以播放了')
... ... @@ -33,7 +35,6 @@ export struct PlayerComponent {
}
updateData() {
console.error('updateData=============')
//直播新闻-直播状态 wait待开播running直播中end已结束cancel已取消paused暂停
if (this.liveDetailsBean.fullColumnImgUrls && this.liveDetailsBean.fullColumnImgUrls.length > 0) {
this.imgUrl = this.liveDetailsBean.fullColumnImgUrls[0].url
... ...
... ... @@ -46,11 +46,12 @@ export struct VideoChannelDetail {
private swiperController: SwiperController = new SwiperController()
@Provide showComment: boolean = false
@Provide windowWidth: number = AppStorage.get<number>('windowWidth') || 0
@Consume pageShow: number
@Consume pageHide: number
@State data: ContentDetailDTO[] = []
@State currentIndex: number = 0
@State interactDataList: InteractDataDTO[] = []
@State totalCount: number = 0
@State switchVideoStatus: boolean = false
@State isMouted: boolean = false
/**
... ... @@ -63,13 +64,13 @@ export struct VideoChannelDetail {
if (this.bottomNavIndex === 2 && this.topNavIndex === 0) {
// 如果视频在暂停则播放视频
this.switchVideoStatus = true
this.barBackgroundColor = Color.Black
this.pageShow = Math.random()
this.openFullScreen()
} else {
// 如果视频在播放则暂停视频
this.switchVideoStatus = false
this.barBackgroundColor = Color.Transparent
this.pageHide = Math.random()
this.closeFullScreen()
}
// timer = -1
... ...