当mediaType设置为VIDEO时,Cordova / Phonegap navigator.camera.getPicture()不会在success()中返回URL

时间:2016-02-03 10:45:07

标签: javascript android cordova phonegap-plugins

我是Cordova的新手。我尝试了以下代码获取视频网址,

 var pictureSource;
 var destinationType;
 var mediaType;

 document.addEventListener("deviceready", onDeviceReady, false);

 function onDeviceReady() {
   pictureSource = navigator.camera.PictureSourceType;
   destinationType = navigator.camera.DestinationType;
   mediaType = navigator.camera.MediaType;
 }

 navigator.camera.getPicture(onPhotoURISuccess, onFail, {
   destinationType: destinationType.FILE_URI,
   mediaType: mediaType.VIDEO,
   sourceType: source
 });

 function onPhotoURISuccess(imageURI) {
   alert(imageURI);
 }

 function onFail(message) {
   alert(message);
 }

当排除mediaType时,代码适用于图片上传。但是当它被设置时,VIDEO alert()不显示任何内容。

提前致谢。

0 个答案:

没有答案