diff --git a/packages/camera/camera_ohos/example/ohos/entry/oh-package.json5 b/packages/camera/camera_ohos/example/ohos/entry/oh-package.json5 index 32f7e89e53a02b5562c5f0b1e0dd0399ab124c3b..078610f17b4a9d75c48dc65508a230e5a4a552fb 100644 --- a/packages/camera/camera_ohos/example/ohos/entry/oh-package.json5 +++ b/packages/camera/camera_ohos/example/ohos/entry/oh-package.json5 @@ -6,9 +6,5 @@ "author": "", "license": "", "dependencies": { - "integration_test": "file:..\\har\\integration_test.har", - "camera_ohos": "file:..\\har\\camera_ohos.har", - "path_provider_ohos": "file:..\\har\\path_provider_ohos.har", - "video_player_ohos": "file:..\\har\\video_player_ohos.har" } } \ No newline at end of file diff --git a/packages/camera/camera_ohos/example/ohos/oh-package.json5 b/packages/camera/camera_ohos/example/ohos/oh-package.json5 index 4a28d3a1bb9c6631e48c6eab667f78e30f5ad08c..8f72a6f6c86d7c91b97dd324494dda410ec79c80 100644 --- a/packages/camera/camera_ohos/example/ohos/oh-package.json5 +++ b/packages/camera/camera_ohos/example/ohos/oh-package.json5 @@ -13,11 +13,6 @@ "@ohos/hypium": "1.0.6" }, "overrides": { - "@ohos/flutter_ohos": "file:./har/flutter.har", - "integration_test": "file:./har/integration_test.har", - "camera_ohos": "file:./har/camera_ohos.har", - "path_provider_ohos": "file:./har/path_provider_ohos.har", - "video_player_ohos": "file:./har/video_player_ohos.har", - "@ohos/flutter_module": "file:./entry" + "@ohos/flutter_ohos": "file:./har/flutter.har" } } \ No newline at end of file diff --git a/packages/camera/camera_ohos/example/pubspec.yaml b/packages/camera/camera_ohos/example/pubspec.yaml index c52a6f51857c4ba492e8f0fbb93c16827613cf61..2114fd20cba38ead601004afebbe2a9206467a46 100644 --- a/packages/camera/camera_ohos/example/pubspec.yaml +++ b/packages/camera/camera_ohos/example/pubspec.yaml @@ -48,8 +48,6 @@ dev_dependencies: sdk: flutter flutter_test: sdk: flutter - integration_test: - sdk: flutter flutter: uses-material-design: true diff --git a/packages/camera/camera_ohos/ohos/src/main/ets/io/flutter/plugins/camera/Camera.ets b/packages/camera/camera_ohos/ohos/src/main/ets/io/flutter/plugins/camera/Camera.ets index 909904bde45104f75cb611951c4518fce313eac6..ac26d2819e0dd72c80ae81e8b0d03a7e5c376d10 100644 --- a/packages/camera/camera_ohos/ohos/src/main/ets/io/flutter/plugins/camera/Camera.ets +++ b/packages/camera/camera_ohos/ohos/src/main/ets/io/flutter/plugins/camera/Camera.ets @@ -55,6 +55,7 @@ import systemDateTime from '@ohos.systemDateTime'; import photoAccessHelper from '@ohos.file.photoAccessHelper'; import { picker } from '@kit.CoreFileKit'; import { DeviceOrientation } from '@ohos/flutter_ohos/src/main/ets/embedding/engine/systemchannels/PlatformChannel'; +import display from '@ohos.display'; const TAG = "Camera"; @@ -758,13 +759,15 @@ export class Camera implements CameraCaptureStateListener { let videoUri: string = getContext(this).cacheDir + '/REC' + Date.now().toString() + '.mp4'; this.captureFile = fs.openSync(videoUri, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE); let fd = this.captureFile.fd; + let displayRotation = display.getDefaultDisplaySync().rotation; + let previewRotation = this.previewOutput?.getPreviewRotation(displayRotation); // 当前录像配置 let aVRecorderConfig: media.AVRecorderConfig = { audioSourceType: media.AudioSourceType.AUDIO_SOURCE_TYPE_MIC, videoSourceType: media.VideoSourceType.VIDEO_SOURCE_TYPE_SURFACE_YUV, profile: this.aVRecorderProfile, url: `fd://${fd}`, - rotation: 90, // 90°为默认竖屏显示角度,如果由于设备原因或应用期望以其他方式显示等原因,请根据实际情况调整该参数 + rotation: previewRotation, }; await this.avRecorder.prepare(aVRecorderConfig).then(async () => { this.videoId = await this.avRecorder?.getInputSurface();