diff --git a/README.en.md b/README.en.md new file mode 100644 index 0000000000000000000000000000000000000000..6a274b8623836d8f5723f4ee3c08f4fac13bbdaf --- /dev/null +++ b/README.en.md @@ -0,0 +1,49 @@ +### System-Level Camera Experience for a Third-Party Camera App + +This sample demonstrates a third-party camera app featuring system-level camera-level effects and functionalities, such as resolution control, moving photo, video stabilization, and continuous zoom. These capabilities are achieved through the open camera capabilities of HarmonyOS. + +### Preview + +![Preview](screenshots/capture.en.png) +![Preview](screenshots/record.en.png) + +### How to Use + +You can touch the round button at the bottom of the screen to take a photo, adjust the zoom and flash settings, and preview the photo. + +### Project Directory + +``` +├──entry/src/main/ets/ +│ ├──constants +│ │ └──CameraConstants.ets +│ ├──entryability +│ │ └──EntryAbility.ets +│ ├──pages +│ │ ├──Index.ets // Home page +│ │ └──MovingPhotoPage.ets // Moving photo preview page +│ ├──utils +│ │ ├──CameraShooter.ets // Photographing +│ │ └──VideoRecorder.ets // Video recording +└──entry/src/main/resource // Static resources +``` + +### How to Implement +Use Camera Kit to take photos and use **photoAccessHelper** to save photos and videos. + +### Required Permissions +1. Apply for the access control list permission to obtain the permission to save photos to the system app Gallery. + +2. Camera permissions: **ohos.permission.CAMERA** and **ohos.permission.MICROPHONE** + +3. Media library permissions: **ohos.permission.READ_IMAGEVIDEO** and **ohos.permission.WRITE_IMAGEVIDEO** + +### Constraints + +1. The sample app is supported only on Huawei phones running the standard system. + +2. The HarmonyOS version must be HarmonyOS NEXT Developer Beta1 or later. + +3. The DevEco Studio version must be DevEco Studio NEXT Developer Beta1 or later. + +4. The HarmonyOS SDK version must be HarmonyOS NEXT Developer Beta1 or later. diff --git a/entry/src/main/ets/pages/Index.ets b/entry/src/main/ets/pages/Index.ets index 9027c26809a8599a97f40d1f3d6173f096a7bc61..fb07bc83321398a447efa5ace65e75e100010c99 100644 --- a/entry/src/main/ets/pages/Index.ets +++ b/entry/src/main/ets/pages/Index.ets @@ -165,6 +165,7 @@ 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')) @@ -239,6 +240,8 @@ struct XComponentPage { stopRecordPreview(); videoRecording(this.isStabilization, cameraPosition, qualityLevel, surfaceId, context, foldAbleStatus); + videoRecording(this.isStabilization, cameraPosition, qualityLevel, surfaceId, context, + foldAbleStatus); } }, { @@ -248,6 +251,8 @@ struct XComponentPage { stopRecordPreview(); videoRecording(this.isStabilization, cameraPosition, qualityLevel, surfaceId, context, foldAbleStatus); + videoRecording(this.isStabilization, cameraPosition, qualityLevel, surfaceId, context, + foldAbleStatus); } } ] @@ -375,6 +380,7 @@ struct XComponentPage { // 1080P this.Initialize(); videoRecording(this.isStabilization, cameraPosition, qualityLevel, surfaceId, context, foldAbleStatus); + videoRecording(this.isStabilization, cameraPosition, qualityLevel, surfaceId, context, foldAbleStatus); isVideo = true; } }) @@ -433,6 +439,7 @@ 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); @@ -459,6 +466,7 @@ 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; @@ -518,4 +526,5 @@ 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/screenshots/capture.en.png b/screenshots/capture.en.png new file mode 100644 index 0000000000000000000000000000000000000000..d2ffed456f5613f28b24ae8a382abaf93284d519 Binary files /dev/null and b/screenshots/capture.en.png differ diff --git a/screenshots/record.en.png b/screenshots/record.en.png new file mode 100644 index 0000000000000000000000000000000000000000..a6ef771901524bcc87238007be80aac394e62d2e Binary files /dev/null and b/screenshots/record.en.png differ