set preferred camera on FuseJS/Camera

Hey, would be cool to have an option to set the preferred camera (front, back) before calling .takePicture, so that the native camera app opens on the one selected.

Something along these lines:

var camera = require('FuseJS/Camera');
camera.setPreferredCamera('front'); // ['front'|'back'|'default']
camera.takePicture(640,480).then(function(file)
{
    // file is a standard JavaScript File object
    // file.path contains the path to the saved image on the device
}).catch(function(e) {
    console.log(e);
});

EDIT: On a second thought, passing a parameter to the .takePicture() function might be better:

var camera = require('FuseJS/Camera');
camera.takePicture(640,480,['front'|'back'|'default']).then(function(file)
{
    // file is a standard JavaScript File object
    // file.path contains the path to the saved image on the device
}).catch(function(e) {
    console.log(e);
});

And on a side note, what would be a good way to make this happen using Uno now?

Hey uldis,

Great feature idea, I will add it to our internal wishlist.

You could totally make your own camera api which controlled this, but it’s not possible to patch the current implementation yourself.

For an example of how to use uno to launch the camera via foreign code see here: https://gist.github.com/cbaggers/489e2533570f246e32157e0018cab95c