Skip to content

cameraDirection property isnt working as suggested #919

@dylnmatthewswork

Description

@dylnmatthewswork

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions