From d7cd3d4b7fc751b06528a844deb8216f6b29b5d2 Mon Sep 17 00:00:00 2001 From: l30052832 Date: Fri, 25 Oct 2024 15:32:45 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=86=97=E4=BD=99=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- entry/src/main/ets/pages/Index.ets | 9 --------- entry/src/main/ets/utils/VideoRecorder.ets | 5 +---- 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/entry/src/main/ets/pages/Index.ets b/entry/src/main/ets/pages/Index.ets index fb07bc8..9027c26 100644 --- a/entry/src/main/ets/pages/Index.ets +++ b/entry/src/main/ets/pages/Index.ets @@ -165,7 +165,6 @@ struct XComponentPage { .onClick(() => { this.isStabilization = !this.isStabilization; videoRecording(this.isStabilization, cameraPosition, qualityLevel, surfaceId, context, foldAbleStatus); - videoRecording(this.isStabilization, cameraPosition, qualityLevel, surfaceId, context, foldAbleStatus); isVideo = true; }); Image(this.isMovingPhoto ? $r('app.media.live_photo_on') : $r('app.media.live_photo_off')) @@ -240,8 +239,6 @@ struct XComponentPage { stopRecordPreview(); videoRecording(this.isStabilization, cameraPosition, qualityLevel, surfaceId, context, foldAbleStatus); - videoRecording(this.isStabilization, cameraPosition, qualityLevel, surfaceId, context, - foldAbleStatus); } }, { @@ -251,8 +248,6 @@ struct XComponentPage { stopRecordPreview(); videoRecording(this.isStabilization, cameraPosition, qualityLevel, surfaceId, context, foldAbleStatus); - videoRecording(this.isStabilization, cameraPosition, qualityLevel, surfaceId, context, - foldAbleStatus); } } ] @@ -380,7 +375,6 @@ struct XComponentPage { // 1080P this.Initialize(); videoRecording(this.isStabilization, cameraPosition, qualityLevel, surfaceId, context, foldAbleStatus); - videoRecording(this.isStabilization, cameraPosition, qualityLevel, surfaceId, context, foldAbleStatus); isVideo = true; } }) @@ -439,7 +433,6 @@ struct XComponentPage { videoUri = await stopRecord(); stopRecordPreview(); videoRecording(this.isStabilization, cameraPosition, qualityLevel, surfaceId, context, foldAbleStatus); - videoRecording(this.isStabilization, cameraPosition, qualityLevel, surfaceId, context, foldAbleStatus); setTimeout(() => { this.getThumbnail(); }, 500); @@ -466,7 +459,6 @@ struct XComponentPage { } else { stopRecordPreview(); videoRecording(this.isStabilization, cameraPosition, qualityLevel, surfaceId, context, foldAbleStatus); - videoRecording(this.isStabilization, cameraPosition, qualityLevel, surfaceId, context, foldAbleStatus); } this.Initialize(); this.isFront = cameraPosition !== 0; @@ -526,5 +518,4 @@ export async function fromBack(): Promise { storage.setOrCreate('isStabilization', false); storage.setOrCreate('isMovingPhoto', false); cameraShooting(isVideo, cameraPosition, surfaceId, context, foldAbleStatus); - cameraShooting(isVideo, cameraPosition, surfaceId, context, foldAbleStatus); } \ No newline at end of file diff --git a/entry/src/main/ets/utils/VideoRecorder.ets b/entry/src/main/ets/utils/VideoRecorder.ets index 4313f80..c850939 100644 --- a/entry/src/main/ets/utils/VideoRecorder.ets +++ b/entry/src/main/ets/utils/VideoRecorder.ets @@ -60,7 +60,7 @@ export async function videoRecording(isStabilization: boolean, cameraPosition: n if (!videoProfilesArray) { return []; } - let previewProfile: undefined | camera.Profile = previewProfilesArray.reverse().find((profile: camera.Profile) => { + let previewProfile: undefined | camera.Profile = previewProfilesArray.find((profile: camera.Profile) => { let screen = display.getDefaultDisplaySync(); if (screen.width <= 1080) { return profile.size.height === 1080 && profile.size.width === 1440; @@ -158,9 +158,6 @@ export async function videoRecording(isStabilization: boolean, cameraPosition: n camera.VideoStabilizationMode.OFF); } await videoSession.start(); - setTimeout(() => { - videoSession.setZoomRatio(0.95); - }, 700); // Obtains the variable focal length ratio range supported by the camera. let zoomRatioRange = videoSession.getZoomRatioRange(); return zoomRatioRange; -- Gitee