1,录音功能
navigator.device.capture.captureAudio( function(files){//成功回调函数 Ext.getCmp("video_files_mainview").config.param.sourceobj.startUpload(files[0].fullPath, 2); }, function(error){//失败回调函数 // navigator.notification.alert('Error code: ' + error.code, null, 'Capture Error'); }, {limit:1});//一次最多录制的文件个数
2。录像功能
navigator.device.capture.captureVideo( function(files){//成功回调 // navigator.notification.alert(files[0].fullPath); Ext.getCmp("video_files_mainview").config.param.sourceobj.startUpload(files[0].fullPath, 1); }, function(){//失败回调 // navigator.notification.alert('错误码:' + err.code, null, 'Uh oh!'); });
录音是调用本地录音机。
3,震动响铃
/** *震动 */ var vibrate = function(){ navigator.notification.vibrate(500); } /** * 响铃 */ var beep = function(){ navigator.notification.beep(1); }
4,拍照功能
navigator.camera.getPicture(function(imgtemp){ //向列表中放圖片 var acqimage =imgtemp; //acqimage.src = "data:image/jpeg;base64," + imageData; param.config.param.sourceobj.startUpload(imgtemp, 0); }, function(){console.log('什麼都沒有得到');}, { quality: 5, destinationType:Camera.DestinationType.FILE_URL, sourceType:Camera.PictureSourceType.CAMERA });
5,选择图片功能
navigator.camera.getPicture(function(imgtemp){ console.log("文件路径:"+imgtemp); },function(){console.log('选择出错');}, <span style="white-space:pre"> </span>{quality:10,//0-100 destinationType:Camera.DestinationType.FILE_URL, sourceType:Camera.PictureSourceType.PHOTOLIBRARY, mediaType:Camera.MediaType.PICTURE});