Showing
5 changed files
with
38 additions
and
47 deletions
| @@ -165,15 +165,15 @@ export struct WdWebLocalComponent { | @@ -165,15 +165,15 @@ export struct WdWebLocalComponent { | ||
| 165 | // 暂停音频悬浮窗 | 165 | // 暂停音频悬浮窗 |
| 166 | pauseAudioCom() { | 166 | pauseAudioCom() { |
| 167 | // 判断当前窗口是否已显示,使用callback异步回调。 | 167 | // 判断当前窗口是否已显示,使用callback异步回调。 |
| 168 | - this.AudioSuspension.floatWindowClass.get().isShowing((err: BusinessError, data) => { | ||
| 169 | - const errCode: number = err.code; | ||
| 170 | - if (errCode) { | ||
| 171 | - return; | ||
| 172 | - } | 168 | + try { |
| 169 | + let data = this.AudioSuspension.floatWindowClass.get().isWindowShowing(); | ||
| 170 | + // console.info(TAG, 'window is showing: ' + data); | ||
| 173 | if(data) { | 171 | if(data) { |
| 174 | this.AudioSuspension.playerController.get()?.pause(); | 172 | this.AudioSuspension.playerController.get()?.pause(); |
| 175 | } | 173 | } |
| 176 | - }); | 174 | + } catch (exception) { |
| 175 | + console.error(TAG, `Failed to check whether the window is showing. Cause code: ${exception.code}, message: ${exception.message}`); | ||
| 176 | + } | ||
| 177 | } | 177 | } |
| 178 | //播放视频 | 178 | //播放视频 |
| 179 | private setCurrentPageOperate9: (data: Message) => void = (data) => { | 179 | private setCurrentPageOperate9: (data: Message) => void = (data) => { |
| @@ -73,13 +73,9 @@ export class AudioSuspensionModel { | @@ -73,13 +73,9 @@ export class AudioSuspensionModel { | ||
| 73 | // 显示悬浮窗。 | 73 | // 显示悬浮窗。 |
| 74 | public showWindow() { | 74 | public showWindow() { |
| 75 | // 判断当前窗口是否已显示,使用callback异步回调。 | 75 | // 判断当前窗口是否已显示,使用callback异步回调。 |
| 76 | - this.floatWindowClass.get().isShowing((err: BusinessError, data) => { | ||
| 77 | - const errCode: number = err.code; | ||
| 78 | - if (errCode) { | ||
| 79 | - // console.error(TAG, 'Failed window is showing Cause:' + JSON.stringify(err)); | ||
| 80 | - return; | ||
| 81 | - } | ||
| 82 | - // console.info(TAG, 'window is showing: ' + JSON.stringify(data)); | 76 | + try { |
| 77 | + let data = this.floatWindowClass.get().isWindowShowing(); | ||
| 78 | + // console.info(TAG, 'window is showing: ' + data); | ||
| 83 | if(data === false) { | 79 | if(data === false) { |
| 84 | // 显示当前窗口,使用callback异步回调。 | 80 | // 显示当前窗口,使用callback异步回调。 |
| 85 | this.floatWindowClass.get().showWindow((err: BusinessError) => { | 81 | this.floatWindowClass.get().showWindow((err: BusinessError) => { |
| @@ -91,7 +87,9 @@ export class AudioSuspensionModel { | @@ -91,7 +87,9 @@ export class AudioSuspensionModel { | ||
| 91 | // console.info(TAG, 'floatWindowClass Succeeded in showing the window.'); | 87 | // console.info(TAG, 'floatWindowClass Succeeded in showing the window.'); |
| 92 | }); | 88 | }); |
| 93 | } | 89 | } |
| 94 | - }); | 90 | + } catch (exception) { |
| 91 | + console.error(TAG, `Failed to check whether the window is showing. Cause code: ${exception.code}, message: ${exception.message}`); | ||
| 92 | + } | ||
| 95 | } | 93 | } |
| 96 | 94 | ||
| 97 | // 设置悬浮窗尺寸 | 95 | // 设置悬浮窗尺寸 |
| @@ -173,19 +173,17 @@ export struct DetailPlayLiveCommon { | @@ -173,19 +173,17 @@ export struct DetailPlayLiveCommon { | ||
| 173 | // 判断当前窗口是否已显示,使用callback异步回调。 | 173 | // 判断当前窗口是否已显示,使用callback异步回调。 |
| 174 | // Logger.info(TAG, 'this.liveState', this.liveState) | 174 | // Logger.info(TAG, 'this.liveState', this.liveState) |
| 175 | if(this.liveState !== 'wait') { | 175 | if(this.liveState !== 'wait') { |
| 176 | - this.AudioSuspension.floatWindowClass.get().isShowing((err: BusinessError, data) => { | ||
| 177 | - const errCode: number = err.code; | ||
| 178 | - if (errCode) { | ||
| 179 | - // console.error(TAG, 'Failed window is showing Cause:' + JSON.stringify(err)); | ||
| 180 | - return; | ||
| 181 | - } | ||
| 182 | - // console.info(TAG, 'window is showing: ' + JSON.stringify(data)); | 176 | + try { |
| 177 | + let data = this.AudioSuspension.floatWindowClass.get().isWindowShowing(); | ||
| 178 | + // console.info(TAG, 'window is showing: ' + data); | ||
| 183 | if(data) { | 179 | if(data) { |
| 184 | this.isShowAudioCom = true | 180 | this.isShowAudioCom = true |
| 185 | this.AudioSuspension.playerController.get()?.pause(); | 181 | this.AudioSuspension.playerController.get()?.pause(); |
| 186 | this.AudioSuspension.minimize() | 182 | this.AudioSuspension.minimize() |
| 187 | } | 183 | } |
| 188 | - }); | 184 | + } catch (exception) { |
| 185 | + console.error(TAG, `Failed to check whether the window is showing. Cause code: ${exception.code}, message: ${exception.message}`); | ||
| 186 | + } | ||
| 189 | } | 187 | } |
| 190 | } | 188 | } |
| 191 | 189 |
| @@ -189,19 +189,17 @@ export struct DetailVideoListPage { | @@ -189,19 +189,17 @@ export struct DetailVideoListPage { | ||
| 189 | this.pageShowTime = DateTimeUtils.getTimeStamp() | 189 | this.pageShowTime = DateTimeUtils.getTimeStamp() |
| 190 | 190 | ||
| 191 | // 判断当前窗口是否已显示,使用callback异步回调。 | 191 | // 判断当前窗口是否已显示,使用callback异步回调。 |
| 192 | - this.AudioSuspension.floatWindowClass.get().isShowing((err: BusinessError, data) => { | ||
| 193 | - const errCode: number = err.code; | ||
| 194 | - if (errCode) { | ||
| 195 | - // console.error(TAG, 'Failed window is showing Cause:' + JSON.stringify(err)); | ||
| 196 | - return; | ||
| 197 | - } | ||
| 198 | - // console.info(TAG, 'window is showing: ' + JSON.stringify(data)); | 192 | + try { |
| 193 | + let data = this.AudioSuspension.floatWindowClass.get().isWindowShowing(); | ||
| 194 | + // console.info(TAG, 'window is showing: ' + data); | ||
| 199 | if(data) { | 195 | if(data) { |
| 200 | this.isShowAudioCom = true | 196 | this.isShowAudioCom = true |
| 201 | this.AudioSuspension.playerController.get()?.pause(); | 197 | this.AudioSuspension.playerController.get()?.pause(); |
| 202 | this.AudioSuspension.minimize() | 198 | this.AudioSuspension.minimize() |
| 203 | } | 199 | } |
| 204 | - }); | 200 | + } catch (exception) { |
| 201 | + console.error(TAG, `Failed to check whether the window is showing. Cause code: ${exception.code}, message: ${exception.message}`); | ||
| 202 | + } | ||
| 205 | 203 | ||
| 206 | const action: Action = router.getParams() as Action; | 204 | const action: Action = router.getParams() as Action; |
| 207 | if (action) { | 205 | if (action) { |
| @@ -55,17 +55,15 @@ export struct VideoChannelPage { | @@ -55,17 +55,15 @@ export struct VideoChannelPage { | ||
| 55 | async aboutToAppear() { | 55 | async aboutToAppear() { |
| 56 | // 背景图高度 | 56 | // 背景图高度 |
| 57 | this.backgroundImageH = px2vp(this.topSafeHeight) + 44 | 57 | this.backgroundImageH = px2vp(this.topSafeHeight) + 44 |
| 58 | - // console.info(`cj2024 backgroundImageH = ${this.backgroundImageH} this.topSafeHeight = ${this.topSafeHeight}`) | 58 | + // console.info(TAG, `cj2024 backgroundImageH = ${this.backgroundImageH} this.topSafeHeight = ${this.topSafeHeight}`) |
| 59 | this.setBarBackgroundColor() | 59 | this.setBarBackgroundColor() |
| 60 | - if (this.currentTopNavSelectedIndex === 0) { | ||
| 61 | - this.handleAudio(this.topNavList[0]) | ||
| 62 | - } | ||
| 63 | } | 60 | } |
| 64 | 61 | ||
| 65 | /** | 62 | /** |
| 66 | * 切换顶部导航index | 63 | * 切换顶部导航index |
| 67 | */ | 64 | */ |
| 68 | setTabbarActive() { | 65 | setTabbarActive() { |
| 66 | + // console.info(TAG, `setTabbarActive`) | ||
| 69 | let index = this.topNavList.findIndex((item: TopNavDTO, index) => { | 67 | let index = this.topNavList.findIndex((item: TopNavDTO, index) => { |
| 70 | return Number(this.assignChannel.channelId) == item.channelId && Number(this.assignChannel.pageId) == item.pageId | 68 | return Number(this.assignChannel.channelId) == item.channelId && Number(this.assignChannel.pageId) == item.pageId |
| 71 | }) || 0 | 69 | }) || 0 |
| @@ -77,7 +75,7 @@ export struct VideoChannelPage { | @@ -77,7 +75,7 @@ export struct VideoChannelPage { | ||
| 77 | * 顶导、底导切换下标都到改变背景色,进入或退出沉浸式 | 75 | * 顶导、底导切换下标都到改变背景色,进入或退出沉浸式 |
| 78 | */ | 76 | */ |
| 79 | setBarBackgroundColor() { | 77 | setBarBackgroundColor() { |
| 80 | - | 78 | + // console.info(TAG, `setBarBackgroundColor`) |
| 81 | if (this.isImmerseChannel() && CompUtils.isVideo(this.currentBottomNavInfo)) { | 79 | if (this.isImmerseChannel() && CompUtils.isVideo(this.currentBottomNavInfo)) { |
| 82 | this.barBackgroundColor = Color.Black | 80 | this.barBackgroundColor = Color.Black |
| 83 | this.isImmersive = true | 81 | this.isImmersive = true |
| @@ -87,7 +85,8 @@ export struct VideoChannelPage { | @@ -87,7 +85,8 @@ export struct VideoChannelPage { | ||
| 87 | this.barBackgroundColor = Color.White | 85 | this.barBackgroundColor = Color.White |
| 88 | ColorUtils.changeTopStatusBarColor(this.navItem.statusBarColor, 1) | 86 | ColorUtils.changeTopStatusBarColor(this.navItem.statusBarColor, 1) |
| 89 | } | 87 | } |
| 90 | - | 88 | + // 底导为视频同时顶导为视频时关闭音频悬浮窗 |
| 89 | + this.handleAudio() | ||
| 91 | } | 90 | } |
| 92 | 91 | ||
| 93 | /** | 92 | /** |
| @@ -125,22 +124,20 @@ export struct VideoChannelPage { | @@ -125,22 +124,20 @@ export struct VideoChannelPage { | ||
| 125 | } | 124 | } |
| 126 | 125 | ||
| 127 | // 控制音频悬浮窗显隐 | 126 | // 控制音频悬浮窗显隐 |
| 128 | - handleAudio(navItem: TopNavDTO) { | ||
| 129 | - if (navItem.name === '视频') { | 127 | + handleAudio() { |
| 128 | + if (this.isImmerseChannel() && CompUtils.isVideo(this.currentBottomNavInfo)) { | ||
| 130 | // 判断当前窗口是否已显示,使用callback异步回调。 | 129 | // 判断当前窗口是否已显示,使用callback异步回调。 |
| 131 | - this.AudioSuspension.floatWindowClass.get().isShowing((err: BusinessError, data) => { | ||
| 132 | - const errCode: number = err.code; | ||
| 133 | - if (errCode) { | ||
| 134 | - // console.error(TAG, 'Failed window is showing Cause:' + JSON.stringify(err)); | ||
| 135 | - return; | ||
| 136 | - } | ||
| 137 | - // console.info(TAG, 'window is showing: ' + JSON.stringify(data)); | 130 | + try { |
| 131 | + let data = this.AudioSuspension.floatWindowClass.get().isWindowShowing(); | ||
| 132 | + // console.info(TAG, 'window is showing: ' + data); | ||
| 138 | if(data) { | 133 | if(data) { |
| 139 | this.isShowAudioCom = true | 134 | this.isShowAudioCom = true |
| 140 | this.AudioSuspension.playerController.get()?.pause(); | 135 | this.AudioSuspension.playerController.get()?.pause(); |
| 141 | this.AudioSuspension.minimize() | 136 | this.AudioSuspension.minimize() |
| 142 | } | 137 | } |
| 143 | - }); | 138 | + } catch (exception) { |
| 139 | + console.error(TAG, `Failed to check whether the window is showing. Cause code: ${exception.code}, message: ${exception.message}`); | ||
| 140 | + } | ||
| 144 | } else { | 141 | } else { |
| 145 | // console.info(TAG, 'this.isShowAudioCom: ' + this.isShowAudioCom); | 142 | // console.info(TAG, 'this.isShowAudioCom: ' + this.isShowAudioCom); |
| 146 | if (this.isShowAudioCom) { | 143 | if (this.isShowAudioCom) { |
| @@ -165,7 +162,7 @@ export struct VideoChannelPage { | @@ -165,7 +162,7 @@ export struct VideoChannelPage { | ||
| 165 | clickTopNav(index: number) { | 162 | clickTopNav(index: number) { |
| 166 | // 视频tab埋点 | 163 | // 视频tab埋点 |
| 167 | const tab = this.topNavList[index] | 164 | const tab = this.topNavList[index] |
| 168 | - this.handleAudio(tab) | 165 | + this.handleAudio() |
| 169 | // Logger.info(TAG, `视频tab埋点: ${JSON.stringify(tab)}`); | 166 | // Logger.info(TAG, `视频tab埋点: ${JSON.stringify(tab)}`); |
| 170 | const params: ParamType = { | 167 | const params: ParamType = { |
| 171 | "pageName": tab.name, | 168 | "pageName": tab.name, |
-
Please register or login to post a comment