From 412885e82ea04b4a907c41f121bd60b1888479e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=98=E6=B5=A9=E7=A8=8B?= <798994511@qq.com> Date: Tue, 27 Aug 2024 16:41:53 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=80=E5=A4=9A=E9=95=BF=E8=A7=86=E9=A2=91?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=AF=A6=E6=83=85=E9=A1=B5=E8=BF=9B=E5=85=A5?= =?UTF-8?q?=E6=82=AC=E5=81=9C=E6=80=81=E6=9D=A1=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- commons/base/src/main/ets/utils/AvPlayerUtil.ets | 2 +- features/videoDetail/src/main/ets/view/VideoDetail.ets | 7 +++++-- features/videoPlayer/src/main/ets/view/VideoPlayer.ets | 4 ---- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/commons/base/src/main/ets/utils/AvPlayerUtil.ets b/commons/base/src/main/ets/utils/AvPlayerUtil.ets index c08657c..8f16786 100644 --- a/commons/base/src/main/ets/utils/AvPlayerUtil.ets +++ b/commons/base/src/main/ets/utils/AvPlayerUtil.ets @@ -230,7 +230,7 @@ export class AvPlayerUtil { playerStateControl(): void { if (this.avPlayer === undefined) { - Logger.error(`AvPlayer is undefined`); + Logger.info(`AvPlayer is undefined`); return; } if (this.avPlayer.state === CommonConstants.AV_PLAYER_STOPPED_STATE) { diff --git a/features/videoDetail/src/main/ets/view/VideoDetail.ets b/features/videoDetail/src/main/ets/view/VideoDetail.ets index 6a120cd..ac02cc9 100644 --- a/features/videoDetail/src/main/ets/view/VideoDetail.ets +++ b/features/videoDetail/src/main/ets/view/VideoDetail.ets @@ -50,8 +50,11 @@ export struct VideoDetail { this.windowUtil.setMainWindowOrientation(window.Orientation.AUTO_ROTATION_RESTRICTED); if (data === display.FoldStatus.FOLD_STATUS_HALF_FOLDED) { this.isHalfFolded = true; - // Full-screen playback. - this.pageInfo.pushPath({ name: 'VideoPlayer' }); + let orientation: display.Orientation = display.getDefaultDisplaySync().orientation; + if (orientation === display.Orientation.LANDSCAPE || orientation === display.Orientation.LANDSCAPE_INVERTED) { + // Full-screen playback. + this.pageInfo.pushPath({ name: 'VideoPlayer' }); + } } else { this.isHalfFolded = false; } diff --git a/features/videoPlayer/src/main/ets/view/VideoPlayer.ets b/features/videoPlayer/src/main/ets/view/VideoPlayer.ets index 0b289fe..da093ca 100644 --- a/features/videoPlayer/src/main/ets/view/VideoPlayer.ets +++ b/features/videoPlayer/src/main/ets/view/VideoPlayer.ets @@ -117,10 +117,6 @@ export struct VideoPlayer { controller: this.xComponentController }) .onLoad(() => { - this.xComponentController.setXComponentSurfaceSize({ - surfaceWidth: CommonConstants.X_COMPONENT_SURFACE_WIDTH, surfaceHeight: - CommonConstants.X_COMPONENT_SURFACE_HEIGHT - }); this.surfaceId = this.xComponentController.getXComponentSurfaceId(); this.avPlayerUtil.createAvPlayer(this.surfaceId, true); }) -- Gitee