diff --git a/entry/src/main/ets/pages/Index.ets b/entry/src/main/ets/pages/Index.ets index fb07bc83321398a447efa5ace65e75e100010c99..9027c26809a8599a97f40d1f3d6173f096a7bc61 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 4313f8035d9a05ac9a913f58a635f63c09829fec..c8509398eaa457dc7512a2cff1a81c614826d345 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;