MUI下
Camera Example// 扩展API加载完毕后调用onPlusReady回调函数
document.addEventListener( "plusready", onPlusReady, false );
// 扩展API加载完毕,现在可以正常调用扩展API
function onPlusReady() {
console.log("plusready");
}
var cmr=null;
// 摄像
function videoCapture(){
cmr = plus.camera.getCamera();
var res = cmr.supportedVideoResolutions[0];
var fmt = cmr.supportedVideoFormats[0];
console.log("Resolution: "+res+", Format: "+fmt);
cmr.startVideoCapture( function( path ){
alert( "Capture video success: " + path );
},
function( error ) {
alert( "Capture video failed: " + error.message );
},
{resolution:res,format:fmt}
);
// 拍摄10s后自动完成
setTimeout( stopCapture, 10000 );
}
// 停止摄像
function stopCapture(){
console.log("stopCapture");
cmr.stopVideoCapture();
}
摄像
停止摄像