Toggle navigation
Toggle navigation
This project
Loading...
Sign in
developOne
/
harmonyPool
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
王士厅
2024-10-12 15:09:36 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
ff89759a85ec1ac8339fa8ac0adbf061c8b9a122
ff89759a
1 parent
e73564ab
fix: 对电子报进行语音播放,切换到视频频道,视频开始播放后、语音没有暂停
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
38 additions
and
47 deletions
sight_harmony/commons/wdWebComponent/src/main/ets/pages/WdWebLocalComponent.ets
sight_harmony/features/wdComponent/src/main/ets/viewmodel/AudioSuspensionModel.ets
sight_harmony/features/wdDetailPlayLive/src/main/ets/pages/DetailPlayLiveCommon.ets
sight_harmony/features/wdDetailPlayShortVideo/src/main/ets/pages/DetailVideoListPage.ets
sight_harmony/products/phone/src/main/ets/pages/view/VideoChannelPage.ets
sight_harmony/commons/wdWebComponent/src/main/ets/pages/WdWebLocalComponent.ets
View file @
ff89759
...
...
@@ -165,15 +165,15 @@ export struct WdWebLocalComponent {
// 暂停音频悬浮窗
pauseAudioCom() {
// 判断当前窗口是否已显示,使用callback异步回调。
this.AudioSuspension.floatWindowClass.get().isShowing((err: BusinessError, data) => {
const errCode: number = err.code;
if (errCode) {
return;
}
try {
let data = this.AudioSuspension.floatWindowClass.get().isWindowShowing();
// console.info(TAG, 'window is showing: ' + data);
if(data) {
this.AudioSuspension.playerController.get()?.pause();
}
});
} catch (exception) {
console.error(TAG, `Failed to check whether the window is showing. Cause code: ${exception.code}, message: ${exception.message}`);
}
}
//播放视频
private setCurrentPageOperate9: (data: Message) => void = (data) => {
...
...
sight_harmony/features/wdComponent/src/main/ets/viewmodel/AudioSuspensionModel.ets
View file @
ff89759
...
...
@@ -73,13 +73,9 @@ export class AudioSuspensionModel {
// 显示悬浮窗。
public showWindow() {
// 判断当前窗口是否已显示,使用callback异步回调。
this.floatWindowClass.get().isShowing((err: BusinessError, data) => {
const errCode: number = err.code;
if (errCode) {
// console.error(TAG, 'Failed window is showing Cause:' + JSON.stringify(err));
return;
}
// console.info(TAG, 'window is showing: ' + JSON.stringify(data));
try {
let data = this.floatWindowClass.get().isWindowShowing();
// console.info(TAG, 'window is showing: ' + data);
if(data === false) {
// 显示当前窗口,使用callback异步回调。
this.floatWindowClass.get().showWindow((err: BusinessError) => {
...
...
@@ -91,7 +87,9 @@ export class AudioSuspensionModel {
// console.info(TAG, 'floatWindowClass Succeeded in showing the window.');
});
}
});
} catch (exception) {
console.error(TAG, `Failed to check whether the window is showing. Cause code: ${exception.code}, message: ${exception.message}`);
}
}
// 设置悬浮窗尺寸
...
...
sight_harmony/features/wdDetailPlayLive/src/main/ets/pages/DetailPlayLiveCommon.ets
View file @
ff89759
...
...
@@ -173,19 +173,17 @@ export struct DetailPlayLiveCommon {
// 判断当前窗口是否已显示,使用callback异步回调。
// Logger.info(TAG, 'this.liveState', this.liveState)
if(this.liveState !== 'wait') {
this.AudioSuspension.floatWindowClass.get().isShowing((err: BusinessError, data) => {
const errCode: number = err.code;
if (errCode) {
// console.error(TAG, 'Failed window is showing Cause:' + JSON.stringify(err));
return;
}
// console.info(TAG, 'window is showing: ' + JSON.stringify(data));
try {
let data = this.AudioSuspension.floatWindowClass.get().isWindowShowing();
// console.info(TAG, 'window is showing: ' + data);
if(data) {
this.isShowAudioCom = true
this.AudioSuspension.playerController.get()?.pause();
this.AudioSuspension.minimize()
}
});
} catch (exception) {
console.error(TAG, `Failed to check whether the window is showing. Cause code: ${exception.code}, message: ${exception.message}`);
}
}
}
...
...
sight_harmony/features/wdDetailPlayShortVideo/src/main/ets/pages/DetailVideoListPage.ets
View file @
ff89759
...
...
@@ -189,19 +189,17 @@ export struct DetailVideoListPage {
this.pageShowTime = DateTimeUtils.getTimeStamp()
// 判断当前窗口是否已显示,使用callback异步回调。
this.AudioSuspension.floatWindowClass.get().isShowing((err: BusinessError, data) => {
const errCode: number = err.code;
if (errCode) {
// console.error(TAG, 'Failed window is showing Cause:' + JSON.stringify(err));
return;
}
// console.info(TAG, 'window is showing: ' + JSON.stringify(data));
try {
let data = this.AudioSuspension.floatWindowClass.get().isWindowShowing();
// console.info(TAG, 'window is showing: ' + data);
if(data) {
this.isShowAudioCom = true
this.AudioSuspension.playerController.get()?.pause();
this.AudioSuspension.minimize()
}
});
} catch (exception) {
console.error(TAG, `Failed to check whether the window is showing. Cause code: ${exception.code}, message: ${exception.message}`);
}
const action: Action = router.getParams() as Action;
if (action) {
...
...
sight_harmony/products/phone/src/main/ets/pages/view/VideoChannelPage.ets
View file @
ff89759
...
...
@@ -55,17 +55,15 @@ export struct VideoChannelPage {
async aboutToAppear() {
// 背景图高度
this.backgroundImageH = px2vp(this.topSafeHeight) + 44
// console.info(`cj2024 backgroundImageH = ${this.backgroundImageH} this.topSafeHeight = ${this.topSafeHeight}`)
// console.info(
TAG,
`cj2024 backgroundImageH = ${this.backgroundImageH} this.topSafeHeight = ${this.topSafeHeight}`)
this.setBarBackgroundColor()
if (this.currentTopNavSelectedIndex === 0) {
this.handleAudio(this.topNavList[0])
}
}
/**
* 切换顶部导航index
*/
setTabbarActive() {
// console.info(TAG, `setTabbarActive`)
let index = this.topNavList.findIndex((item: TopNavDTO, index) => {
return Number(this.assignChannel.channelId) == item.channelId && Number(this.assignChannel.pageId) == item.pageId
}) || 0
...
...
@@ -77,7 +75,7 @@ export struct VideoChannelPage {
* 顶导、底导切换下标都到改变背景色,进入或退出沉浸式
*/
setBarBackgroundColor() {
// console.info(TAG, `setBarBackgroundColor`)
if (this.isImmerseChannel() && CompUtils.isVideo(this.currentBottomNavInfo)) {
this.barBackgroundColor = Color.Black
this.isImmersive = true
...
...
@@ -87,7 +85,8 @@ export struct VideoChannelPage {
this.barBackgroundColor = Color.White
ColorUtils.changeTopStatusBarColor(this.navItem.statusBarColor, 1)
}
// 底导为视频同时顶导为视频时关闭音频悬浮窗
this.handleAudio()
}
/**
...
...
@@ -125,22 +124,20 @@ export struct VideoChannelPage {
}
// 控制音频悬浮窗显隐
handleAudio(navItem: TopNavDTO) {
if (navItem.name === '视频') {
handleAudio() {
if (this.isImmerseChannel() && CompUtils.isVideo(this.currentBottomNavInfo)) {
// 判断当前窗口是否已显示,使用callback异步回调。
this.AudioSuspension.floatWindowClass.get().isShowing((err: BusinessError, data) => {
const errCode: number = err.code;
if (errCode) {
// console.error(TAG, 'Failed window is showing Cause:' + JSON.stringify(err));
return;
}
// console.info(TAG, 'window is showing: ' + JSON.stringify(data));
try {
let data = this.AudioSuspension.floatWindowClass.get().isWindowShowing();
// console.info(TAG, 'window is showing: ' + data);
if(data) {
this.isShowAudioCom = true
this.AudioSuspension.playerController.get()?.pause();
this.AudioSuspension.minimize()
}
});
} catch (exception) {
console.error(TAG, `Failed to check whether the window is showing. Cause code: ${exception.code}, message: ${exception.message}`);
}
} else {
// console.info(TAG, 'this.isShowAudioCom: ' + this.isShowAudioCom);
if (this.isShowAudioCom) {
...
...
@@ -165,7 +162,7 @@ export struct VideoChannelPage {
clickTopNav(index: number) {
// 视频tab埋点
const tab = this.topNavList[index]
this.handleAudio(
tab
)
this.handleAudio()
// Logger.info(TAG, `视频tab埋点: ${JSON.stringify(tab)}`);
const params: ParamType = {
"pageName": tab.name,
...
...
Please
register
or
login
to post a comment