examples/phonegap1/plugins/cordova-plugin-camera/src/blackberry10/index.js
function showCameraDialog (done, cancel, fail) {
    var wv = qnx.webplatform.createWebView(function () {
        wv.url = 'local:///chrome/camera.html';
        wv.allowQnxObject = true;
        wv.allowRpc = true;
        wv.zOrder = 1;
        wv.setGeometry(0, 0, screen.width, screen.height);
        wv.backgroundColor = 0x00000000;
        wv.active = true;
        wv.visible = true;
        wv.on('UserMediaRequest', function (evt, args) {
            wv.allowUserMedia(JSON.parse(args).id, 'CAMERA_UNIT_REAR');
        });
        wv.on('JavaScriptCallback', function (evt, data) {
            var args = JSON.parse(data).args;
            if (args[0] === 'cordova-plugin-camera') {
                if (args[1] === 'cancel') {
                    cancel('User canceled');
                } else if (args[1] === 'error') {
                    fail(args[2]);
                } else {
                    saveImage(args[1], done, fail);
                }
                wv.un('JavaScriptCallback', arguments.callee);
                wv.visible = false;
                wv.destroy();
                qnx.webplatform.getApplication().unlockRotation();
            }
        });
        wv.on('Destroyed', function () {
            wv.delete();
        });
        qnx.webplatform.getApplication().lockRotation();
        qnx.webplatform.getController().dispatchEvent('webview.initialized', [wv]);
    });
}
function showCameraDialog (done, cancel, fail) {
    var wv = qnx.webplatform.createWebView(function () {
        wv.url = 'local:///chrome/camera.html';
        wv.allowQnxObject = true;
        wv.allowRpc = true;
        wv.zOrder = 1;
        wv.setGeometry(0, 0, screen.width, screen.height);
        wv.backgroundColor = 0x00000000;
        wv.active = true;
        wv.visible = true;
        wv.on('UserMediaRequest', function (evt, args) {
            wv.allowUserMedia(JSON.parse(args).id, 'CAMERA_UNIT_REAR');
        });
        wv.on('JavaScriptCallback', function (evt, data) {
            var args = JSON.parse(data).args;
            if (args[0] === 'cordova-plugin-camera') {
                if (args[1] === 'cancel') {
                    cancel('User canceled');
                } else if (args[1] === 'error') {
                    fail(args[2]);
                } else {
                    saveImage(args[1], done, fail);
                }
                wv.un('JavaScriptCallback', arguments.callee);
                wv.visible = false;
                wv.destroy();
                qnx.webplatform.getApplication().unlockRotation();
            }
        });
        wv.on('Destroyed', function () {
            wv.delete();
        });
        qnx.webplatform.getApplication().lockRotation();
        qnx.webplatform.getController().dispatchEvent('webview.initialized', [wv]);
    });
}
function showCameraDialog ( done , cancel , fail ) { var wv = qnx . webplatform . createWebView ( function ( ) { wv . url = 'local:///chrome/camera.html' ; wv . allowQnxObject = true ; wv . allowRpc = true ; wv . zOrder = 1 ; wv . setGeometry ( 0 , 0 , screen . width , screen . height ) ; wv . backgroundColor = 0x00000000 ; wv . active = true ; wv . visible = true ; wv . on ( 'UserMediaRequest' , function ( evt , args ) { wv . allowUserMedia ( JSON . parse ( args ) . id , 'CAMERA_UNIT_REAR' ) ; } ) ; wv . on ( 'JavaScriptCallback' , function ( evt , data ) { var args = JSON . parse ( data ) . args ; if ( args [ 0 ] === 'cordova-plugin-camera' ) { if ( args [ 1 ] === 'cancel' ) { cancel ( 'User canceled' ) ; } else if ( args [ 1 ] === 'error' ) { fail ( args [ 2 ] ) ; } else { saveImage ( args [ 1 ] , done , fail ) ; } wv . un ( 'JavaScriptCallback' , arguments . callee ) ; wv . visible = false ; wv . destroy ( ) ; qnx . webplatform . getApplication ( ) . unlockRotation ( ) ; } } ) ; wv . on ( 'Destroyed' , function ( ) { wv . delete ( ) ; } ) ; qnx . webplatform . getApplication ( ) . lockRotation ( ) ; qnx . webplatform . getController ( ) . dispatchEvent ( 'webview.initialized' , [ wv ] ) ; } ) ; }
open a webview with getUserMedia camera card implementation when camera card not available
open a webview with getUserMedia camera card implementation when camera card not available