From 9abca4b2585bc76b47bbccd7e4f1bc3940bc08a7 Mon Sep 17 00:00:00 2001 From: sfchu Date: Sat, 22 Mar 2025 16:13:53 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E3=80=90=E5=AE=9E=E7=8E=B0=E7=94=BB?= =?UTF-8?q?=E4=B8=AD=E7=94=BB=E6=95=88=E6=9E=9C=E3=80=91HMOS=E4=B8=96?= =?UTF-8?q?=E7=95=8C=E9=9B=86=E6=88=90sample=E6=95=B4=E6=94=B9=09CodeCheck?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- entry/src/main/ets/constants/Constants.ets | 4 ++-- entry/src/main/ets/pages/AVPlayer.ets | 18 +++++++++--------- entry/src/main/ets/pages/VideoPlay.ets | 4 ++-- entry/src/main/ets/pages/WindowPip.ets | 5 ++--- 4 files changed, 15 insertions(+), 16 deletions(-) diff --git a/entry/src/main/ets/constants/Constants.ets b/entry/src/main/ets/constants/Constants.ets index f7dc118..8a43b4e 100644 --- a/entry/src/main/ets/constants/Constants.ets +++ b/entry/src/main/ets/constants/Constants.ets @@ -112,7 +112,7 @@ export class Constants { /** * GridRow gutter lg. */ - public static readonly GRID_ROW_lg: number = 16; + public static readonly GRID_ROW_LG: number = 16; /** * GridRow gutter y. @@ -127,7 +127,7 @@ export class Constants { /** * Idle state. */ - public static readonly idle_STATUS: string = 'idle'; + public static readonly IDLE_STATUS: string = 'idle'; /** * Resource Initialization. diff --git a/entry/src/main/ets/pages/AVPlayer.ets b/entry/src/main/ets/pages/AVPlayer.ets index 9372919..4e6665e 100644 --- a/entry/src/main/ets/pages/AVPlayer.ets +++ b/entry/src/main/ets/pages/AVPlayer.ets @@ -26,20 +26,20 @@ export class AVPlayer { private surfaceID: string; private jumpNext: boolean = false; // It is used to distinguish between the player of the main interface and the player of the pip interface. - type: number = 0; - State: string = ''; - playStatus: boolean = true; + private type: number = 0; + private state: string = ''; + private playStatus: boolean = true; constructor(surfaceID: string, type: number) { this.surfaceID = surfaceID; this.type = type; getContext().eventHub.on('appStateChange', (fg: boolean) => { if (fg) { - if (this.State === Constants.PAUSED_STATUS) { + if (this.state === Constants.PAUSED_STATUS) { this.avPlayer?.play(); } } else { - if (this.State === Constants.PLAYING_STATUS) { + if (this.state === Constants.PLAYING_STATUS) { this.avPlayer?.pause(); } } @@ -68,10 +68,10 @@ export class AVPlayer { if (!this.avPlayer) { return; } - this.State = state; + this.state = state; switch (state) { // After the RESET API is successfully called, the state machine is triggered. - case Constants.idle_STATUS: + case Constants.IDLE_STATUS: Logger.info('AVPlayer state idle called.'); if (!this.jumpNext) { // Call the release operation to destroy the instance object. @@ -161,14 +161,14 @@ export class AVPlayer { } play(): void { - if ((this.State === Constants.PAUSED_STATUS || this.State === Constants.PREPARED_STATUS) && + if ((this.state === Constants.PAUSED_STATUS || this.state === Constants.PREPARED_STATUS) && this.playStatus === true) { this.avPlayer?.play(); } } pause(): void { - if (this.State === Constants.PLAYING_STATUS) { + if (this.state === Constants.PLAYING_STATUS) { this.avPlayer?.pause(); } } diff --git a/entry/src/main/ets/pages/VideoPlay.ets b/entry/src/main/ets/pages/VideoPlay.ets index 32a4ede..0e1f00e 100644 --- a/entry/src/main/ets/pages/VideoPlay.ets +++ b/entry/src/main/ets/pages/VideoPlay.ets @@ -128,11 +128,11 @@ export struct PlayVideo { } setStatusStyle(statusBarContentColor: string): void { - let SystemBarProperties: window.SystemBarProperties = { + let systemBarProperties: window.SystemBarProperties = { statusBarContentColor: statusBarContentColor }; try { - let promise = this.mainWin.setWindowSystemBarProperties(SystemBarProperties); + let promise = this.mainWin.setWindowSystemBarProperties(systemBarProperties); promise.then(() => { Logger.info('Succeeded in setting the system bar properties.'); }).catch((err: BusinessError) => { diff --git a/entry/src/main/ets/pages/WindowPip.ets b/entry/src/main/ets/pages/WindowPip.ets index c2f6a20..8ca1bf5 100644 --- a/entry/src/main/ets/pages/WindowPip.ets +++ b/entry/src/main/ets/pages/WindowPip.ets @@ -47,7 +47,6 @@ struct ImageWidthTitle { .alignItems(HorizontalAlign.Start) .onClick(() => { getContext().eventHub.emit('onStateChange', true); - // router.pushUrl({url:'pages/VideoPlay'}) this.pageInfos?.pushPath({ name: Constants.NAV_DESTINATION_NAME }, { launchMode: 3 }); }) .onAreaChange((oldArea: Area, newArea: Area) => { @@ -96,11 +95,11 @@ struct WindowPip { } setStatusStyle(statusBarContentColor: string): void { - let SystemBarProperties: window.SystemBarProperties = { + let systemBarProperties: window.SystemBarProperties = { statusBarContentColor: statusBarContentColor }; try { - let promise = this.mainWin.setWindowSystemBarProperties(SystemBarProperties); + let promise = this.mainWin.setWindowSystemBarProperties(systemBarProperties); promise.then(() => { Logger.info('Succeeded in setting the system bar properties.'); }).catch((err: BusinessError) => { -- Gitee From 429217950accf76cbdb6434112224e475e44560f Mon Sep 17 00:00:00 2001 From: sfchu Date: Sat, 22 Mar 2025 16:34:50 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E3=80=90=E5=AE=9E=E7=8E=B0=E7=94=BB?= =?UTF-8?q?=E4=B8=AD=E7=94=BB=E6=95=88=E6=9E=9C=E3=80=91HMOS=E4=B8=96?= =?UTF-8?q?=E7=95=8C=E9=9B=86=E6=88=90sample=E6=95=B4=E6=94=B9=09CodeCheck?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- entry/src/main/ets/pages/AVPlayer.ets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/entry/src/main/ets/pages/AVPlayer.ets b/entry/src/main/ets/pages/AVPlayer.ets index 4e6665e..60181ef 100644 --- a/entry/src/main/ets/pages/AVPlayer.ets +++ b/entry/src/main/ets/pages/AVPlayer.ets @@ -26,7 +26,7 @@ export class AVPlayer { private surfaceID: string; private jumpNext: boolean = false; // It is used to distinguish between the player of the main interface and the player of the pip interface. - private type: number = 0; + public type: number = 0; private state: string = ''; private playStatus: boolean = true; -- Gitee