wangliang_wd

Merge branch 'main' of http://192.168.1.42/developOne/harmonyPool into main

* 'main' of http://192.168.1.42/developOne/harmonyPool:
  fix |> 20004 我的>设置,wifi网络情况下自动播放视频选项,应默认打开
  fix: 对稿件进行语音播放并暂停后,点击关闭按钮后,手机下拉中的播放组件没有删除
  fix: 视频频道中对视频在播放状态下,先暂停、再播放,然后切换到其他频道再返回、视频没有继续播放
  ref |> 调整竖屏直播结束页面关注按钮高度
  ref |> 互动消息跳转时,带上relId relType
  fix: 对稿件或早晚报进行语音播放时,切换至视频频道【直播】后,语音播放被暂停了,且语音动效也被删除了
  ref |> 调整文章详情页缺省页逻辑
@@ -284,7 +284,7 @@ export struct ImageAndTextPageComponent { @@ -284,7 +284,7 @@ export struct ImageAndTextPageComponent {
284 .justifyContent(FlexAlign.SpaceBetween) 284 .justifyContent(FlexAlign.SpaceBetween)
285 .alignItems(VerticalAlign.Bottom) 285 .alignItems(VerticalAlign.Bottom)
286 286
287 - if (this.isNetConnected && !this.detailContentEmpty) { 287 + // if (this.isNetConnected && !this.detailContentEmpty) {
288 Row() { 288 Row() {
289 Image($r('app.media.ic_news_detail_division')) 289 Image($r('app.media.ic_news_detail_division'))
290 .width('100%') 290 .width('100%')
@@ -294,7 +294,7 @@ export struct ImageAndTextPageComponent { @@ -294,7 +294,7 @@ export struct ImageAndTextPageComponent {
294 } 294 }
295 .padding({ left: 15, right: 15 }) 295 .padding({ left: 15, right: 15 })
296 .backgroundColor(Color.White) 296 .backgroundColor(Color.White)
297 - } 297 + // }
298 }.backgroundColor(Color.White) 298 }.backgroundColor(Color.White)
299 } 299 }
300 .margin({top: `${this.topSafeHeight}px`, bottom: `${this.bottomSafeHeight}px`}) 300 .margin({top: `${this.topSafeHeight}px`, bottom: `${this.bottomSafeHeight}px`})
@@ -82,6 +82,8 @@ export struct InteractMComponent { @@ -82,6 +82,8 @@ export struct InteractMComponent {
82 let contentDTO :ContentDTO = new ContentDTO(); 82 let contentDTO :ContentDTO = new ContentDTO();
83 contentDTO.objectType = this.messageModel.InteractMsubM.contentType 83 contentDTO.objectType = this.messageModel.InteractMsubM.contentType
84 contentDTO.objectId = this.messageModel.InteractMsubM.contentId 84 contentDTO.objectId = this.messageModel.InteractMsubM.contentId
  85 + contentDTO.relId = this.messageModel.InteractMsubM.contentRelId
  86 + contentDTO.relType = this.messageModel.InteractMsubM.contentRelType
85 ProcessUtils.processPage(contentDTO) 87 ProcessUtils.processPage(contentDTO)
86 }) 88 })
87 } 89 }
@@ -26,7 +26,7 @@ export class MineSettingDatasModel { @@ -26,7 +26,7 @@ export class MineSettingDatasModel {
26 mainSettingData.push(new MineMainSettingFunctionItem(null, '隐私设罝', null, 0, false,"private_setting")) 26 mainSettingData.push(new MineMainSettingFunctionItem(null, '隐私设罝', null, 0, false,"private_setting"))
27 let wifiState=SPHelper.default.getSync(SpConstants.SETTING_WIFI_IMAGE_SWITCH,false) as boolean 27 let wifiState=SPHelper.default.getSync(SpConstants.SETTING_WIFI_IMAGE_SWITCH,false) as boolean
28 mainSettingData.push(new MineMainSettingFunctionItem(null, '仅wifi网络加载图片', null, 1, wifiState,"wifi_switch")) 28 mainSettingData.push(new MineMainSettingFunctionItem(null, '仅wifi网络加载图片', null, 1, wifiState,"wifi_switch"))
29 - let videoState=SPHelper.default.getSync(SpConstants.SETTING_WIFI_VIDEO_SWITCH,false) as boolean 29 + let videoState=SPHelper.default.getSync(SpConstants.SETTING_WIFI_VIDEO_SWITCH,true) as boolean
30 mainSettingData.push(new MineMainSettingFunctionItem(null, 'wifi网络情况下自动播放视频', null, 1, videoState,"video_switch")) 30 mainSettingData.push(new MineMainSettingFunctionItem(null, 'wifi网络情况下自动播放视频', null, 1, videoState,"video_switch"))
31 let suspensionState=SPHelper.default.getSync(SpConstants.SETTING_SUSPENSION_SWITCH,false) as boolean 31 let suspensionState=SPHelper.default.getSync(SpConstants.SETTING_SUSPENSION_SWITCH,false) as boolean
32 // mainSettingData.push(new MineMainSettingFunctionItem(null, '开启播放器悬浮窗', null, 1, suspensionState,"suspensionState_switch")) 32 // mainSettingData.push(new MineMainSettingFunctionItem(null, '开启播放器悬浮窗', null, 1, suspensionState,"suspensionState_switch"))
@@ -16,7 +16,7 @@ async function onlyWifiLoadImg(): Promise<boolean> { @@ -16,7 +16,7 @@ async function onlyWifiLoadImg(): Promise<boolean> {
16 } 16 }
17 17
18 async function onlyWifiLoadVideo(): Promise<boolean> { 18 async function onlyWifiLoadVideo(): Promise<boolean> {
19 - let loadImageOnlyWifiSwitch = await SPHelper.default.get(SpConstants.SETTING_WIFI_VIDEO_SWITCH, '') || false; 19 + let loadImageOnlyWifiSwitch = await SPHelper.default.get(SpConstants.SETTING_WIFI_VIDEO_SWITCH, true) || false;
20 if (!loadImageOnlyWifiSwitch) { 20 if (!loadImageOnlyWifiSwitch) {
21 // 开关没开,直接让加载视频 21 // 开关没开,直接让加载视频
22 return true 22 return true
@@ -9,6 +9,8 @@ import { publishCommentModel } from 'wdComponent/src/main/ets/components/comment @@ -9,6 +9,8 @@ import { publishCommentModel } from 'wdComponent/src/main/ets/components/comment
9 import { PictureLoading } from '../widgets/vertical/PictureLoading'; 9 import { PictureLoading } from '../widgets/vertical/PictureLoading';
10 import { TrackConstants, TrackingPageBrowse } from 'wdTracking/Index'; 10 import { TrackConstants, TrackingPageBrowse } from 'wdTracking/Index';
11 import { LiveDetailPageLogic } from '../viewModel/LiveDetailPageLogic'; 11 import { LiveDetailPageLogic } from '../viewModel/LiveDetailPageLogic';
  12 +import { AudioSuspensionModel } from 'wdComponent'
  13 +import { BusinessError } from '@kit.BasicServicesKit';
12 14
13 const TAG = 'DetailPlayLiveCommon' 15 const TAG = 'DetailPlayLiveCommon'
14 16
@@ -60,15 +62,8 @@ export struct DetailPlayLiveCommon { @@ -60,15 +62,8 @@ export struct DetailPlayLiveCommon {
60 // 是否隐藏Loading view 62 // 是否隐藏Loading view
61 @State isHideLoading: boolean = false 63 @State isHideLoading: boolean = false
62 64
63 - async aboutToAppear(): Promise<void> {  
64 - const par: Action = router.getParams() as Action;  
65 - const params = par?.params;  
66 - this.relId = params?.extra?.relId || '';  
67 - this.relType = params?.extra?.relType || '';  
68 - this.contentId = params?.contentID || '';  
69 - this.getContentDetail()  
70 -  
71 - } 65 + private AudioSuspension = new AudioSuspensionModel()
  66 + @State isShowAudioCom: boolean = false
72 67
73 build() { 68 build() {
74 Column() { 69 Column() {
@@ -92,82 +87,116 @@ export struct DetailPlayLiveCommon { @@ -92,82 +87,116 @@ export struct DetailPlayLiveCommon {
92 /** 87 /**
93 * 查询视频详情用于评论展示 88 * 查询视频详情用于评论展示
94 */ 89 */
95 - getContentDetail() { 90 + getContentDetail(): Promise<void> {
  91 + return new Promise<void>((resolve, reject) => {
96 this.liveViewModel.getContentDetail(this.contentId, this.relId, this.relType) 92 this.liveViewModel.getContentDetail(this.contentId, this.relId, this.relType)
97 .then(async (data: Array<ContentDetailDTO>) => { 93 .then(async (data: Array<ContentDetailDTO>) => {
98 - console.log(TAG, '查询视频详情用于评论展示 getContentDetail:', JSON.stringify(data))  
99 - if (data) {  
100 - let detailData = data[0]  
101 - //人民号类型单独获取直播地址  
102 - if (detailData.rmhPlatform === 1 && detailData.liveInfo?.liveState === 'running') { //  
103 - let vliveId = detailData.liveInfo.vlive[0].vliveId as string  
104 - let pullStreamAddressData = await this.liveViewModel.getLiveRoomPullAddress(vliveId) as GetPullAddressBean  
105 - if (pullStreamAddressData) {  
106 - // console.log(TAG, ' GetPullAddressBean:', JSON.stringify(pullStreamAddressData))  
107 - let m3u8uUrl = pullStreamAddressData.transCode[0].m3u8Url  
108 - detailData.liveInfo.vlive[0].liveUrl = m3u8uUrl  
109 - this.playUrl = m3u8uUrl 94 + // console.log(TAG, '查询视频详情用于评论展示 getContentDetail:', JSON.stringify(data));
  95 +
  96 + if (!data || data.length === 0) {
  97 + this.isHideLoading = true;
  98 + ToastUtils.shortToast('内容不存在');
  99 + router.back();
  100 + reject();
  101 + return;
110 } 102 }
111 - }  
112 -  
113 - this.liveState = detailData.liveInfo?.liveState  
114 -  
115 - this.contentDetailData = data[0]  
116 -  
117 - this.liveDetailPageLogic.contentDetailData = this.contentDetailData  
118 -  
119 - this.liveDetailPageLogic.liveLandscape = detailData?.liveInfo?.liveLandScape  
120 -  
121 - this.liveDetailPageLogic.liveState = detailData.liveInfo?.liveState  
122 -  
123 - this.liveDetailPageLogic.resolvingRoomImgSource()  
124 103
125 - this.liveDetailPageLogic.resolvingRoomVliveData(0) 104 + const detailData = data[0];
126 105
127 - this.publishCommentModel.targetId = String(detailData?.newsId || '')  
128 - this.publishCommentModel.targetRelId = String(detailData?.reLInfo?.relId || '')  
129 - this.publishCommentModel.targetTitle = detailData?.newsTitle  
130 - this.publishCommentModel.targetRelType = String(detailData?.reLInfo?.relType || '')  
131 - this.publishCommentModel.targetRelObjectId = String(detailData?.reLInfo?.relObjectId || '')  
132 - this.publishCommentModel.keyArticle = String(detailData?.keyArticle || '')  
133 - this.publishCommentModel.targetType = String(detailData?.newsType || '')  
134 - this.publishCommentModel.visitorComment = String(detailData?.visitorComment || '')  
135 - this.publishCommentModel.commentContent = ''  
136 - this.liveStyle = detailData.liveInfo?.liveStyle 106 + // 人民号类型单独获取直播地址
  107 + if (detailData.rmhPlatform === 1 && detailData.liveInfo?.liveState === 'running') {
  108 + const vliveId = detailData.liveInfo.vlive[0].vliveId as string;
  109 + const pullStreamAddressData = await this.liveViewModel.getLiveRoomPullAddress(vliveId) as GetPullAddressBean;
137 110
138 - if (detailData.liveInfo.liveState == 'end') {  
139 - this.playUrl = detailData.liveInfo.vlive[0].replayUri 111 + if (pullStreamAddressData) {
  112 + const m3u8uUrl = pullStreamAddressData.transCode[0].m3u8Url;
  113 + detailData.liveInfo.vlive[0].liveUrl = m3u8uUrl;
  114 + this.playUrl = m3u8uUrl;
  115 + }
140 } 116 }
141 117
142 - } else {  
143 - this.isHideLoading = true  
144 - ToastUtils.shortToast('内容不存在')  
145 - router.back() 118 + this.liveState = detailData.liveInfo?.liveState;
  119 + this.contentDetailData = detailData;
  120 + this.liveDetailPageLogic.contentDetailData = this.contentDetailData;
  121 + this.liveDetailPageLogic.liveLandscape = detailData?.liveInfo?.liveLandScape;
  122 + this.liveDetailPageLogic.liveState = detailData.liveInfo?.liveState;
  123 + this.liveDetailPageLogic.resolvingRoomImgSource();
  124 + this.liveDetailPageLogic.resolvingRoomVliveData(0);
  125 +
  126 + const publishCommentModel = this.publishCommentModel;
  127 + publishCommentModel.targetId = String(detailData?.newsId || '');
  128 + publishCommentModel.targetRelId = String(detailData?.reLInfo?.relId || '');
  129 + publishCommentModel.targetTitle = detailData?.newsTitle;
  130 + publishCommentModel.targetRelType = String(detailData?.reLInfo?.relType || '');
  131 + publishCommentModel.targetRelObjectId = String(detailData?.reLInfo?.relObjectId || '');
  132 + publishCommentModel.keyArticle = String(detailData?.keyArticle || '');
  133 + publishCommentModel.targetType = String(detailData?.newsType || '');
  134 + publishCommentModel.visitorComment = String(detailData?.visitorComment || '');
  135 + publishCommentModel.commentContent = '';
  136 + this.liveStyle = detailData.liveInfo?.liveStyle;
  137 +
  138 + if (detailData.liveInfo?.liveState === 'end') {
  139 + this.playUrl = detailData.liveInfo.vlive[0].replayUri;
146 } 140 }
147 - }, () => {  
148 - this.isHideLoading = true  
149 - ToastUtils.shortToast('内容不存在')  
150 - router.back()  
151 141
  142 + resolve();
152 }) 143 })
  144 + .catch(() => {
  145 + this.isHideLoading = true;
  146 + ToastUtils.shortToast('内容不存在');
  147 + router.back();
  148 + reject();
  149 + });
  150 + });
153 } 151 }
154 152
155 - onPageShow() { 153 +
  154 + async onPageShow() {
156 this.pageShow = Math.random() 155 this.pageShow = Math.random()
157 - Logger.info(TAG, 'onPageShow') 156 + // Logger.info(TAG, 'onPageShow')
158 this.pageShowTime = DateTimeUtils.getTimeStamp() 157 this.pageShowTime = DateTimeUtils.getTimeStamp()
159 WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#ffffff'}) 158 WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#ffffff'})
  159 + const par: Action = router.getParams() as Action;
  160 + const params = par?.params;
  161 + this.relId = params?.extra?.relId || '';
  162 + this.relType = params?.extra?.relType || '';
  163 + this.contentId = params?.contentID || '';
  164 + await this.getContentDetail()
  165 + // 判断当前窗口是否已显示,使用callback异步回调。
  166 + // Logger.info(TAG, 'this.liveState', this.liveState)
  167 + if(this.liveState !== 'wait') {
  168 + this.AudioSuspension.floatWindowClass.get().isShowing((err: BusinessError, data) => {
  169 + const errCode: number = err.code;
  170 + if (errCode) {
  171 + // console.error(TAG, 'Failed window is showing Cause:' + JSON.stringify(err));
  172 + return;
  173 + }
  174 + // console.info(TAG, 'window is showing: ' + JSON.stringify(data));
  175 + if(data) {
  176 + this.isShowAudioCom = true
  177 + this.AudioSuspension.playerController.get()?.pause();
  178 + this.AudioSuspension.minimize()
  179 + }
  180 + });
  181 + }
160 } 182 }
161 183
162 onPageHide() { 184 onPageHide() {
163 WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#000000'}) 185 WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#000000'})
164 this.pageHide = Math.random() 186 this.pageHide = Math.random()
165 - Logger.info(TAG, 'onPageHide') 187 + // Logger.info(TAG, 'onPageHide')
166 //页面浏览 188 //页面浏览
167 TrackingPageBrowse.trackCommonPageExposureEnd(TrackConstants.PageName.Live_Detail, 189 TrackingPageBrowse.trackCommonPageExposureEnd(TrackConstants.PageName.Live_Detail,
168 TrackConstants.PageName.Live_Detail 190 TrackConstants.PageName.Live_Detail
169 , Math.floor((DateTimeUtils.getTimeStamp() - this.pageShowTime) / 1000)) 191 , Math.floor((DateTimeUtils.getTimeStamp() - this.pageShowTime) / 1000))
170 192
  193 + if(this.liveState !== 'wait') {
  194 + if (this.isShowAudioCom) {
  195 + this.AudioSuspension.showWindow()
  196 + this.isShowAudioCom = false
  197 + }
  198 + }
  199 +
171 } 200 }
172 201
173 onBackPress(): boolean | void { 202 onBackPress(): boolean | void {
@@ -117,7 +117,7 @@ export struct PlayerEndView { @@ -117,7 +117,7 @@ export struct PlayerEndView {
117 .fontColor('#B2FFFFFF') 117 .fontColor('#B2FFFFFF')
118 .padding({ top: 8 }) 118 .padding({ top: 8 })
119 } 119 }
120 - 120 + Blank().height(this.contentDetailData.rmhInfo == null ? 26:16)
121 Stack() { 121 Stack() {
122 Row() { 122 Row() {
123 Column() { 123 Column() {
@@ -134,8 +134,7 @@ export struct PlayerEndView { @@ -134,8 +134,7 @@ export struct PlayerEndView {
134 Text('观看人数').fontWeight(400).fontSize(12).fontColor(Color.White) 134 Text('观看人数').fontWeight(400).fontSize(12).fontColor(Color.White)
135 } 135 }
136 } 136 }
137 - .padding({ top: this.contentDetailData.rmhInfo == null ? 26 : 16 })  
138 - Text('').width(1).height(32).margin({ left: 36, right: 36,top:this.contentDetailData.rmhInfo == null ? 26 : 16 }).backgroundColor('#33FFFFFF') 137 + Text('').width(1).height(32).backgroundColor('#33FFFFFF')
139 } 138 }
140 if (this.contentDetailData.rmhInfo != null) { 139 if (this.contentDetailData.rmhInfo != null) {
141 Row() { 140 Row() {
@@ -149,6 +148,7 @@ export struct PlayerEndView { @@ -149,6 +148,7 @@ export struct PlayerEndView {
149 left: 122, 148 left: 122,
150 right: 122 149 right: 122
151 }) 150 })
  151 + .height(42)
152 .backgroundColor(this.followStatus == '0' ? '#FFED2800' : '#CCCCCC') 152 .backgroundColor(this.followStatus == '0' ? '#FFED2800' : '#CCCCCC')
153 .borderRadius(4) 153 .borderRadius(4)
154 .onClick(() => { 154 .onClick(() => {
@@ -306,9 +306,9 @@ export struct DetailPlayShortVideoPage { @@ -306,9 +306,9 @@ export struct DetailPlayShortVideoPage {
306 onHeightDidChange: (height: number) => { 306 onHeightDidChange: (height: number) => {
307 this.playerWidth = px2vp(this.windowWidth) 307 this.playerWidth = px2vp(this.windowWidth)
308 this.playerHeight = px2vp(this.windowHeight - height) 308 this.playerHeight = px2vp(this.windowHeight - height)
309 - Logger.debug(TAG,  
310 - "height: " + px2vp(height) + " ===> 视频高度: " + this.playerHeight + " window height: " +  
311 - px2vp(this.windowHeight)) 309 + // Logger.debug(TAG,
  310 + // "height: " + px2vp(height) + " ===> 视频高度: " + this.playerHeight + " window height: " +
  311 + // px2vp(this.windowHeight))
312 } 312 }
313 }) 313 })
314 this.playerViewBuilder() 314 this.playerViewBuilder()
@@ -332,13 +332,9 @@ export struct DetailPlayShortVideoPage { @@ -332,13 +332,9 @@ export struct DetailPlayShortVideoPage {
332 .layoutWeight(1) 332 .layoutWeight(1)
333 .onClick(() => { 333 .onClick(() => {
334 this.playerController?.switchPlayOrPause(); 334 this.playerController?.switchPlayOrPause();
  335 + this.isPlay = !this.isPlay
335 this.playerController.onStatusChange = (status: number) => { 336 this.playerController.onStatusChange = (status: number) => {
336 this.status = status 337 this.status = status
337 - if (status === PlayerConstants.STATUS_PAUSE) {  
338 - this.isPlay = false  
339 - } else if (status === PlayerConstants.STATUS_START) {  
340 - this.isPlay = true  
341 - }  
342 } 338 }
343 }) 339 })
344 340
@@ -27,7 +27,7 @@ export class BackgroundAudioController { @@ -27,7 +27,7 @@ export class BackgroundAudioController {
27 27
28 public gotContextFunc?: () => Context 28 public gotContextFunc?: () => Context
29 public avplayerController?: WDPlayerController 29 public avplayerController?: WDPlayerController
30 - private lastSession?: AVSessionManager.AVSession 30 + private lastSession?: AVSessionManager.AVSession | null
31 31
32 private applyedLongTaskPlay: boolean = false 32 private applyedLongTaskPlay: boolean = false
33 33
@@ -64,6 +64,7 @@ export class BackgroundAudioController { @@ -64,6 +64,7 @@ export class BackgroundAudioController {
64 if (this.lastSession) { 64 if (this.lastSession) {
65 this.lastSession.deactivate(); 65 this.lastSession.deactivate();
66 this.lastSession.destroy(); 66 this.lastSession.destroy();
  67 + this.lastSession = null
67 } 68 }
68 } 69 }
69 70
1 import { AudioSuspensionModel } from 'wdComponent' 1 import { AudioSuspensionModel } from 'wdComponent'
2 -import { PlayerConstants, DateFormatUtil } from 'wdPlayer' 2 +import { PlayerConstants, DateFormatUtil, BackgroundAudioController } from 'wdPlayer'
3 import { EmitterEventId, EmitterUtils, SPHelper } from 'wdKit/Index' 3 import { EmitterEventId, EmitterUtils, SPHelper } from 'wdKit/Index'
4 import window from '@ohos.window'; 4 import window from '@ohos.window';
5 import lottie from '@ohos/lottie'; 5 import lottie from '@ohos/lottie';
@@ -195,6 +195,7 @@ struct Index { @@ -195,6 +195,7 @@ struct Index {
195 if (this.AudioSuspension.playerController) { 195 if (this.AudioSuspension.playerController) {
196 this.AudioSuspension.playerController.get().pause() 196 this.AudioSuspension.playerController.get().pause()
197 this.AudioSuspension.minimize() 197 this.AudioSuspension.minimize()
  198 + BackgroundAudioController.sharedController().destorySession()
198 } 199 }
199 })) 200 }))
200 } 201 }
@@ -9,8 +9,6 @@ import { VideoChannelPage } from './VideoChannelPage'; @@ -9,8 +9,6 @@ import { VideoChannelPage } from './VideoChannelPage';
9 import ChannelViewModel from 'wdComponent/src/main/ets/viewmodel/ChannelViewModel'; 9 import ChannelViewModel from 'wdComponent/src/main/ets/viewmodel/ChannelViewModel';
10 import { ALL, ImageKnifeComponent, ImageKnifeOption } from '@ohos/imageknife'; 10 import { ALL, ImageKnifeComponent, ImageKnifeOption } from '@ohos/imageknife';
11 import { ParamType, Tracking } from 'wdTracking/Index'; 11 import { ParamType, Tracking } from 'wdTracking/Index';
12 -import { AudioSuspensionModel } from 'wdComponent'  
13 -import { BusinessError } from '@kit.BasicServicesKit';  
14 import { GrayManageModel } from 'wdComponent/src/main/ets/viewmodel/GrayManageModel'; 12 import { GrayManageModel } from 'wdComponent/src/main/ets/viewmodel/GrayManageModel';
15 13
16 const TAG = 'BottomNavigationComponent'; 14 const TAG = 'BottomNavigationComponent';
@@ -54,8 +52,6 @@ export struct BottomNavigationComponent { @@ -54,8 +52,6 @@ export struct BottomNavigationComponent {
54 @State assignChannel: AssignChannelParam = new AssignChannelParam() 52 @State assignChannel: AssignChannelParam = new AssignChannelParam()
55 // 自动刷新触发(双击tab自动刷新) 53 // 自动刷新触发(双击tab自动刷新)
56 @State autoRefresh: number = 0 54 @State autoRefresh: number = 0
57 - private AudioSuspension = new AudioSuspensionModel()  
58 - @State isShowAudioCom: boolean = false  
59 // 国殇灰度管理 55 // 国殇灰度管理
60 GrayManage: SubscribedAbstractProperty<GrayManageModel> = AppStorage.link<GrayManageModel>('GrayManage') 56 GrayManage: SubscribedAbstractProperty<GrayManageModel> = AppStorage.link<GrayManageModel>('GrayManage')
61 57
@@ -157,9 +153,6 @@ export struct BottomNavigationComponent { @@ -157,9 +153,6 @@ export struct BottomNavigationComponent {
157 .hoverEffect(HoverEffect.Highlight) 153 .hoverEffect(HoverEffect.Highlight)
158 .visibility(this.displayDirection === DisplayDirection.VERTICAL ? Visibility.Visible : Visibility.None) 154 .visibility(this.displayDirection === DisplayDirection.VERTICAL ? Visibility.Visible : Visibility.None)
159 // .hitTestBehavior(HitTestMode.Block) 155 // .hitTestBehavior(HitTestMode.Block)
160 - .onTouch(() => {  
161 - this.handleAudio(navItem)  
162 - })  
163 .onClick(() => { 156 .onClick(() => {
164 // Logger.info(TAG, `onChange, index: ${index}`); 157 // Logger.info(TAG, `onChange, index: ${index}`);
165 // Logger.info(TAG, `onChange, navItem: ${JSON.stringify(navItem)}`); 158 // Logger.info(TAG, `onChange, navItem: ${JSON.stringify(navItem)}`);
@@ -268,32 +261,6 @@ export struct BottomNavigationComponent { @@ -268,32 +261,6 @@ export struct BottomNavigationComponent {
268 return isSelect ? $r('app.media.icon_tab_res1') : $r('app.media.icon_tab_res1_no') 261 return isSelect ? $r('app.media.icon_tab_res1') : $r('app.media.icon_tab_res1_no')
269 } 262 }
270 263
271 - // 控制音频悬浮窗显隐  
272 - handleAudio(navItem: BottomNavDTO) {  
273 - if (navItem.name === '视频') {  
274 - // 判断当前窗口是否已显示,使用callback异步回调。  
275 - this.AudioSuspension.floatWindowClass.get().isShowing((err: BusinessError, data) => {  
276 - const errCode: number = err.code;  
277 - if (errCode) {  
278 - // console.error(TAG, 'Failed window is showing Cause:' + JSON.stringify(err));  
279 - return;  
280 - }  
281 - // console.info(TAG, 'window is showing: ' + JSON.stringify(data));  
282 - if(data) {  
283 - this.isShowAudioCom = true  
284 - this.AudioSuspension.playerController.get()?.pause();  
285 - this.AudioSuspension.minimize()  
286 - }  
287 - });  
288 - } else {  
289 - // console.info(TAG, 'this.isShowAudioCom: ' + this.isShowAudioCom);  
290 - if (this.isShowAudioCom) {  
291 - this.AudioSuspension.showWindow()  
292 - this.isShowAudioCom = false  
293 - }  
294 - }  
295 - }  
296 -  
297 // 底导切换函数 264 // 底导切换函数
298 async onBottomNavigationIndexChange(navItem: BottomNavDTO, index: number) { 265 async onBottomNavigationIndexChange(navItem: BottomNavDTO, index: number) {
299 // Logger.info(TAG, `onBottomNavigationIndexChange to Index:${index},this.currentNavIndex: ${this.currentNavIndex}`); 266 // Logger.info(TAG, `onBottomNavigationIndexChange to Index:${index},this.currentNavIndex: ${this.currentNavIndex}`);
@@ -13,6 +13,8 @@ import { ParamType, Tracking } from 'wdTracking/Index'; @@ -13,6 +13,8 @@ import { ParamType, Tracking } from 'wdTracking/Index';
13 import { ColorUtils } from 'wdComponent/src/main/ets/utils/ColorUtils'; 13 import { ColorUtils } from 'wdComponent/src/main/ets/utils/ColorUtils';
14 import { ImageKnifeComponent } from '@ohos/imageknife'; 14 import { ImageKnifeComponent } from '@ohos/imageknife';
15 import { CommonUtils } from 'wdComponent/src/main/ets/utils/CommonUtils'; 15 import { CommonUtils } from 'wdComponent/src/main/ets/utils/CommonUtils';
  16 +import { AudioSuspensionModel } from 'wdComponent'
  17 +import { BusinessError } from '@kit.BasicServicesKit';
16 18
17 const TAG = 'VideoChannelPage' 19 const TAG = 'VideoChannelPage'
18 20
@@ -42,6 +44,8 @@ export struct VideoChannelPage { @@ -42,6 +44,8 @@ export struct VideoChannelPage {
42 // 背景高度 44 // 背景高度
43 @State backgroundImageH: number = 0 45 @State backgroundImageH: number = 0
44 @Consume @Watch('setBarBackgroundColor') pageShow: number 46 @Consume @Watch('setBarBackgroundColor') pageShow: number
  47 + private AudioSuspension = new AudioSuspensionModel()
  48 + @State isShowAudioCom: boolean = false
45 // 国殇灰度管理 49 // 国殇灰度管理
46 GrayManage: SubscribedAbstractProperty<GrayManageModel> = AppStorage.link<GrayManageModel>('GrayManage') 50 GrayManage: SubscribedAbstractProperty<GrayManageModel> = AppStorage.link<GrayManageModel>('GrayManage')
47 51
@@ -50,6 +54,9 @@ export struct VideoChannelPage { @@ -50,6 +54,9 @@ export struct VideoChannelPage {
50 this.backgroundImageH = px2vp(this.topSafeHeight) + 44 54 this.backgroundImageH = px2vp(this.topSafeHeight) + 44
51 // console.info(`cj2024 backgroundImageH = ${this.backgroundImageH} this.topSafeHeight = ${this.topSafeHeight}`) 55 // console.info(`cj2024 backgroundImageH = ${this.backgroundImageH} this.topSafeHeight = ${this.topSafeHeight}`)
52 this.setBarBackgroundColor() 56 this.setBarBackgroundColor()
  57 + if (this.currentTopNavSelectedIndex === 0) {
  58 + this.handleAudio(this.topNavList[0])
  59 + }
53 } 60 }
54 61
55 /** 62 /**
@@ -100,6 +107,32 @@ export struct VideoChannelPage { @@ -100,6 +107,32 @@ export struct VideoChannelPage {
100 107
101 } 108 }
102 109
  110 + // 控制音频悬浮窗显隐
  111 + handleAudio(navItem: TopNavDTO) {
  112 + if (navItem.name === '视频') {
  113 + // 判断当前窗口是否已显示,使用callback异步回调。
  114 + this.AudioSuspension.floatWindowClass.get().isShowing((err: BusinessError, data) => {
  115 + const errCode: number = err.code;
  116 + if (errCode) {
  117 + // console.error(TAG, 'Failed window is showing Cause:' + JSON.stringify(err));
  118 + return;
  119 + }
  120 + // console.info(TAG, 'window is showing: ' + JSON.stringify(data));
  121 + if(data) {
  122 + this.isShowAudioCom = true
  123 + this.AudioSuspension.playerController.get()?.pause();
  124 + this.AudioSuspension.minimize()
  125 + }
  126 + });
  127 + } else {
  128 + // console.info(TAG, 'this.isShowAudioCom: ' + this.isShowAudioCom);
  129 + if (this.isShowAudioCom) {
  130 + this.AudioSuspension.showWindow()
  131 + this.isShowAudioCom = false
  132 + }
  133 + }
  134 + }
  135 +
103 build() { 136 build() {
104 Stack({ alignContent: Alignment.Top }) { 137 Stack({ alignContent: Alignment.Top }) {
105 138
@@ -152,6 +185,7 @@ export struct VideoChannelPage { @@ -152,6 +185,7 @@ export struct VideoChannelPage {
152 .onClick(() => { 185 .onClick(() => {
153 // 视频tab埋点 186 // 视频tab埋点
154 const tab = this.topNavList[index] 187 const tab = this.topNavList[index]
  188 + this.handleAudio(tab)
155 Logger.info(TAG, `视频tab埋点: ${JSON.stringify(tab)}`); 189 Logger.info(TAG, `视频tab埋点: ${JSON.stringify(tab)}`);
156 const params: ParamType = { 190 const params: ParamType = {
157 "pageName": tab.name, 191 "pageName": tab.name,