capacitor-community / camera-preview

Capacitor plugin that allows camera interaction from HTML code
MIT License
189 stars 166 forks source link

Capacitor 6 and Camera Preview 6, on Ionic 8, Android Native CameraPreview.startRecordingVideo() bug #351

Open pullpushtree opened 6 days ago

pullpushtree commented 6 days ago

There are multiple bugs when using the Android Native Camera Preview plugin.

Bug 1: Camera Preview Options - toBack Property Description: When initializing the Camera Preview Options, setting the toBack property to true allows the live video preview feed to be displayed but hides the control buttons. Conversely, setting toBack to false makes the controls visible, but the live video preview feed is not displayed.

Impact: This issue prevents users from interacting with controls while viewing the camera preview, leading to a poor user experience.

Bug 2: Undefined Result on Video Recording Description: When calling CameraPreview.startRecordVideo(options), the result returned is undefined. Consequently, when attempting to call CameraPreview.stopRecordVideo(), the result is empty.

Impact: This bug makes it impossible to retrieve or handle recorded video data, hindering functionality related to video recording and playback.

Here are the logs:

CP - handleVideoButtonClick called chat.page.ts:407 CP - Video recorder is now visible. VM3:372 native Camera.checkPermissions (#55622006) VM3:379 ObjectcallbackId: "55622006"methodName: "checkPermissions"options: {}pluginId: "Camera"[[Prototype]]: Object VM3:346 result Camera.checkPermissions (#55622006) VM3:357 Objectcamera: "granted"photos: "granted"readExternalStorage: "denied"saveGallery: "denied"[[Prototype]]: Object VM3:372 native CameraPreview.start (#55622007) VM3:379 ObjectcallbackId: "55622007"methodName: "start"options: {position: 'rear', parent: 'cameraPreview', className: 'cameraPreview', x: 0, y: 0, …}pluginId: "CameraPreview"[[Prototype]]: Object VM3:346 result CameraPreview.start (#55622007) VM3:357 undefined VM3:372 native CameraPreview.startRecordVideo (#55622008) VM3:379 ObjectcallbackId: "55622008"methodName: "startRecordVideo"options: {x: 0, y: 0, width: 360, height: 726, position: 'front', …}pluginId: "CameraPreview"[[Prototype]]: Object VM3:346 result CameraPreview.startRecordVideo (#55622008) VM3:357 undefined video-recorder.component.ts:183 VRC - Native video recording started VM3:372 native CameraPreview.stopRecordVideo (#55622009) VM3:379 ObjectcallbackId: "55622009"methodName: "stopRecordVideo"options: {}pluginId: "CameraPreview"[[Prototype]]: Object VM3:346 result CameraPreview.stopRecordVideo (#55622009)

AndroidManifes.xml Permissions :

<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

dependencies :

"@capacitor-community/camera-preview": "^6.0.0",
"@capacitor/android": "6.1.1",
"@capacitor/angular": "^2.0.3",
"@capacitor/app": "6.0.0",
"@capacitor/camera": "^6.0.2",
"@capacitor/core": "^6.1.1",   
"@ionic/angular": "^8.2.6",

devDependencies :

"@angular/cli": "^17.2.0",
"@angular/compiler-cli": "^17.2.0",
"@angular/language-service": "^17.2.0",
"@capacitor/cli": "6.1.1",

Device :

 Samsung S21

Camera Preview Native Android Device