zhenghy

修复直播频道切换问题

@@ -5,6 +5,8 @@ import router from '@ohos.router'; @@ -5,6 +5,8 @@ import router from '@ohos.router';
5 import { DetailPlayLivePage } from './DetailPlayLivePage' 5 import { DetailPlayLivePage } from './DetailPlayLivePage'
6 import { DetailPlayVLivePage } from './DetailPlayVLivePage' 6 import { DetailPlayVLivePage } from './DetailPlayVLivePage'
7 7
  8 +const TAG = 'DetailPlayLiveCommon'
  9 +
8 @Entry() 10 @Entry()
9 @Component 11 @Component
10 export struct DetailPlayLiveCommon { 12 export struct DetailPlayLiveCommon {
@@ -47,7 +49,7 @@ export struct DetailPlayLiveCommon { @@ -47,7 +49,7 @@ export struct DetailPlayLiveCommon {
47 this.liveDetailsBean = data[0] 49 this.liveDetailsBean = data[0]
48 this.liveState = this.liveDetailsBean.liveInfo?.liveState 50 this.liveState = this.liveDetailsBean.liveInfo?.liveState
49 this.liveStyle = this.liveDetailsBean.liveInfo.liveStyle 51 this.liveStyle = this.liveDetailsBean.liveInfo.liveStyle
50 - console.error('liveDetailsBean===', JSON.stringify((this.liveDetailsBean))) 52 + console.log(TAG, 'getLiveDetails:', JSON.stringify((this.liveDetailsBean)))
51 } 53 }
52 }, 54 },
53 () => { 55 () => {
@@ -8,11 +8,11 @@ import { WDPlayerController } from 'wdPlayer/Index'; @@ -8,11 +8,11 @@ import { WDPlayerController } from 'wdPlayer/Index';
8 import { DisplayDirection } from 'wdConstant/Index'; 8 import { DisplayDirection } from 'wdConstant/Index';
9 9
10 const storage = LocalStorage.getShared(); 10 const storage = LocalStorage.getShared();
  11 +const TAG = 'DetailPlayVLivePage'
11 12
12 @Entry(storage) 13 @Entry(storage)
13 @Component 14 @Component
14 export struct DetailPlayVLivePage { 15 export struct DetailPlayVLivePage {
15 - TAG: string = 'DetailPlayVLivePage';  
16 private liveViewModel: LiveViewModel = new LiveViewModel() 16 private liveViewModel: LiveViewModel = new LiveViewModel()
17 private playerController: WDPlayerController = new WDPlayerController(); 17 private playerController: WDPlayerController = new WDPlayerController();
18 private swiperController: SwiperController = new SwiperController() 18 private swiperController: SwiperController = new SwiperController()
@@ -29,6 +29,7 @@ export struct DetailPlayVLivePage { @@ -29,6 +29,7 @@ export struct DetailPlayVLivePage {
29 @State swiperIndex: number = 1 29 @State swiperIndex: number = 1
30 30
31 aboutToAppear(): void { 31 aboutToAppear(): void {
  32 + console.log(TAG, 'aboutToAppear')
32 WindowModel.shared.setWindowLayoutFullScreen(true) 33 WindowModel.shared.setWindowLayoutFullScreen(true)
33 WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#ffffff', }) 34 WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#ffffff', })
34 35
@@ -86,11 +87,11 @@ export struct DetailPlayVLivePage { @@ -86,11 +87,11 @@ export struct DetailPlayVLivePage {
86 if (data.length > 0) { 87 if (data.length > 0) {
87 this.liveDetailsBean = data[0] 88 this.liveDetailsBean = data[0]
88 this.liveState = this.liveDetailsBean.liveInfo?.liveState 89 this.liveState = this.liveDetailsBean.liveInfo?.liveState
89 - console.error('liveDetailsBean===', JSON.stringify((this.liveDetailsBean))) 90 + console.log(TAG, 'getLiveDetails', JSON.stringify((this.liveDetailsBean)))
90 } 91 }
91 }, 92 },
92 - () => {  
93 - 93 + (message: string) => {
  94 + console.error(TAG, 'getLiveDetails catch', message)
94 }) 95 })
95 } 96 }
96 97
@@ -99,9 +100,10 @@ export struct DetailPlayVLivePage { @@ -99,9 +100,10 @@ export struct DetailPlayVLivePage {
99 .then( 100 .then(
100 (data) => { 101 (data) => {
101 this.liveRoomDataBean = data 102 this.liveRoomDataBean = data
  103 + console.log(TAG, 'getLiveRoomData', JSON.stringify((this.liveRoomDataBean)))
102 }, 104 },
103 - () => {  
104 - 105 + (message: string) => {
  106 + console.error(TAG, 'getLiveDetails catch', message)
105 }) 107 })
106 } 108 }
107 } 109 }
@@ -2,6 +2,7 @@ import { LiveDetailsBean } from 'wdBean/Index'; @@ -2,6 +2,7 @@ import { LiveDetailsBean } from 'wdBean/Index';
2 import { WDPlayerController, WDPlayerRenderVLiveView, WDPlayerRenderView } from 'wdPlayer/Index'; 2 import { WDPlayerController, WDPlayerRenderVLiveView, WDPlayerRenderView } from 'wdPlayer/Index';
3 import componentUtils from '@ohos.arkui.componentUtils'; 3 import componentUtils from '@ohos.arkui.componentUtils';
4 4
  5 +const TAG = 'PlayerComponent'
5 6
6 @Component 7 @Component
7 export struct PlayerComponent { 8 export struct PlayerComponent {
@@ -16,6 +17,7 @@ export struct PlayerComponent { @@ -16,6 +17,7 @@ export struct PlayerComponent {
16 @State playUrl: string = '' 17 @State playUrl: string = ''
17 18
18 aboutToAppear(): void { 19 aboutToAppear(): void {
  20 + console.log(TAG, 'aboutToAppear')
19 if (this.playerController) { 21 if (this.playerController) {
20 this.playerController.onCanplay = () => { 22 this.playerController.onCanplay = () => {
21 console.log('可以播放了') 23 console.log('可以播放了')
@@ -33,7 +35,6 @@ export struct PlayerComponent { @@ -33,7 +35,6 @@ export struct PlayerComponent {
33 } 35 }
34 36
35 updateData() { 37 updateData() {
36 - console.error('updateData=============')  
37 //直播新闻-直播状态 wait待开播running直播中end已结束cancel已取消paused暂停 38 //直播新闻-直播状态 wait待开播running直播中end已结束cancel已取消paused暂停
38 if (this.liveDetailsBean.fullColumnImgUrls && this.liveDetailsBean.fullColumnImgUrls.length > 0) { 39 if (this.liveDetailsBean.fullColumnImgUrls && this.liveDetailsBean.fullColumnImgUrls.length > 0) {
39 this.imgUrl = this.liveDetailsBean.fullColumnImgUrls[0].url 40 this.imgUrl = this.liveDetailsBean.fullColumnImgUrls[0].url
@@ -46,11 +46,12 @@ export struct VideoChannelDetail { @@ -46,11 +46,12 @@ export struct VideoChannelDetail {
46 private swiperController: SwiperController = new SwiperController() 46 private swiperController: SwiperController = new SwiperController()
47 @Provide showComment: boolean = false 47 @Provide showComment: boolean = false
48 @Provide windowWidth: number = AppStorage.get<number>('windowWidth') || 0 48 @Provide windowWidth: number = AppStorage.get<number>('windowWidth') || 0
  49 + @Consume pageShow: number
  50 + @Consume pageHide: number
49 @State data: ContentDetailDTO[] = [] 51 @State data: ContentDetailDTO[] = []
50 @State currentIndex: number = 0 52 @State currentIndex: number = 0
51 @State interactDataList: InteractDataDTO[] = [] 53 @State interactDataList: InteractDataDTO[] = []
52 @State totalCount: number = 0 54 @State totalCount: number = 0
53 - @State switchVideoStatus: boolean = false  
54 @State isMouted: boolean = false 55 @State isMouted: boolean = false
55 56
56 /** 57 /**
@@ -63,13 +64,13 @@ export struct VideoChannelDetail { @@ -63,13 +64,13 @@ export struct VideoChannelDetail {
63 64
64 if (this.bottomNavIndex === 2 && this.topNavIndex === 0) { 65 if (this.bottomNavIndex === 2 && this.topNavIndex === 0) {
65 // 如果视频在暂停则播放视频 66 // 如果视频在暂停则播放视频
66 - this.switchVideoStatus = true  
67 this.barBackgroundColor = Color.Black 67 this.barBackgroundColor = Color.Black
  68 + this.pageShow = Math.random()
68 this.openFullScreen() 69 this.openFullScreen()
69 } else { 70 } else {
70 // 如果视频在播放则暂停视频 71 // 如果视频在播放则暂停视频
71 - this.switchVideoStatus = false  
72 this.barBackgroundColor = Color.Transparent 72 this.barBackgroundColor = Color.Transparent
  73 + this.pageHide = Math.random()
73 this.closeFullScreen() 74 this.closeFullScreen()
74 } 75 }
75 // timer = -1 76 // timer = -1