apache / apache/cordova-plugin-camera
cameraDirection property isnt working as suggested
- Dominant language
- Objective-C
- Stars
- 976
- Forks
- 1.6k
- PR merge metrics
- No merged PRs in 30d
Description
# Bug Report
## Problem
### What is expected to happen?
I expect the camera to always open using the back camera.
### What does actually happen?
It opens upusing the front camera when minimizing the app and opening native camera app and switching to front camera.
When i come back to my app and open up the camera it uses the front camera instead of the back.
## Information
If i leave the app and open up the camera app and put it on front option now my ionic app also uses the front option instead of defaulting to back camera
### Command or Code
const options: CameraOptions = {
quality: this.platform.is("ios") ? 60 : 70,
destinationType: this.camera.DestinationType.DATA_URL,
encodingType: this.camera.EncodingType.JPEG,
mediaType: this.camera.MediaType.PICTURE,
sourceType: sourceType,
correctOrientation: true,
saveToPhotoAlbum: imageSource === 'camera'? true: false,
cameraDirection: this.camera.Direction.BACK
};
### Environment, Platform, Device
Android
### Version information
ionic 6
"cordova-plugin-camera": "^8.0.0",
Android Studio Ladybug | 2024.2.1 Patch 2
cordova -v
11.1.0
ionic info
Ionic:
Ionic CLI : 6.20.8 (C:\Users\xxx\AppData\Roaming\npm\node_modules\@ionic\cli)
Ionic Framework : @ionic/angular 6.7.5
@angular-devkit/build-angular : 14.2.12
@angular-devkit/schematics : 14.2.12
@angular/cli : 14.2.12
@ionic/angular-toolkit : 6.1.0
Cordova:
Cordova CLI : 11.1.0
Cordova Platforms : android 13.0.0
Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 5.0.0, (and 16 other plugins)
Utility:
cordova-res : not installed globally
native-run : 1.7.2
System:
Android SDK Tools : 26.1.1 (C:\Users\xxx\AppData\Local\Android\Sdk\)
NodeJS : v16.16.0 (C:\Program Files\nodejs\node.exe)
npm : 8.11.0
OS : Windows 10
## Checklist
- [x ] I searched for existing GitHub issues
- [x ] I updated all Cordova tooling to most recent version
- [x ] I included all the necessary information above
Contributor guide
Research direction
Start with the cameraDirection option in the provided CameraOptions configuration and review how the Android camera flow handles app minimization and return from the native camera app. Reproduce the sequence on Android, switching the native camera to front before returning. Done means reopening the Ionic app camera consistently selects the back camera when Direction.BACK is specified.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, typescript
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100