Start a new topic
Solved

Cordova front facing camera iOS

I've set up a simple screen capture example that works perfectly using the back camera, but fails to include the camera image when using the front.


Back camera = camera image +/- web overlay

Front camera = no camera image +/- web overlay 


The image saves to photos, and can be used as file.


Phonegap CLI 6.4.6

SDK 6.1

iOS 10.2


I read a post from 2014 about adding this as a selfie feature https://support.wikitude.com/support/discussions/topics/5000079518


Did it get added to the SDK?


Thanks,


Paul


Good morning Paul,



I just took a Screenshot using our Cordova sample app with the camera frame included. I'd like you to verify that it's not working for you using the same approach. I just used the 08_BrowsingPois_6_Bonus-CaptureScreen sample and changed it to use the front facing camera instead of the back facing camera by altering the sampleIndices.js file as follows.


{
    "path": "www/world/08_BrowsingPois_6_Bonus-CaptureScreen/index.html",
     "requiredFeatures": [
         "geo",
         "photo_library_screenshot_import"
     ],
     "startupConfiguration": {
         "camera_resolution": "auto",
         "camera_position": "front"
    }
}

 

As always with Cordova, be aware that the build process of Cordova has a horrible habit of duplicating files. So make sure to alter the right file, or, when in doubt, alter them all.


I ran this on iOS 10.2 on an iPad Air 2 with SDK 6.1 and Cordova 6.5.0.



- Daniel


Hi Daniel,


Thanks for information. I have found a solution, which I'm happy to share.


I'm using the back camera for most parts, switching to the front camera for the selfie.


When I capture the screen (using front camera), I need to swap to the back camera. It was here that the problem occurred, as I was doing the swap before the image had fully processed.


I'm now waiting for the image to be processed before setting

AR.hardware.camera.position = AR.CONST.CAMERA_POSITION.BACK;


Thanks,


Paul

Excellent. Happy to hear you sorted this out and thanks for sharing the solution.


- Daniel

Login or Signup to post a comment