【发布时间】:2013-10-16 10:32:07
【问题描述】:
是否支持在 phonegap (cordova) 中使用声音捕获视频? 我在我的 iPad 上检查了一个带有 Video Capture 的 phonegap 3.1 应用程序,并且没有视频录音
感谢帮助 谢谢
function uploadFile(mediaFile) {
var ft = new FileTransfer(),
path = mediaFile.fullPath,
name = mediaFile.name;
ft.upload(path,
"http://www/api/up_video",
function(result) {
cordova.logger.log('Upload success: ' + result.responseCode);
cordova.logger.log(result.bytesSent + ' bytes sent');
},
function(error) {
cordova.logger.log('Error uploading file ' + path + ': ' + error.code);
},
{ fileName: name });
}
// capture callback
var captureSuccess = function(mediaFiles) {
var i, path, len;
for (i = 0, len = mediaFiles.length; i < len; i += 1) {
path = mediaFiles[i].fullPath;
name = mediaFiles[i].name;
// do something interesting with the file
alert(name);
//alert(mediaFiles[i].size);
//alert(mediaFiles[i].type);
uploadFile(mediaFiles[i]);
}
};
// capture error callback
var captureError = function(error) {
navigator.notification.alert('Error code: ' + error.code, null, 'Capture Error');
cordova.logger.log( error);
};
navigator.device.capture.captureVideo(captureSuccess, captureError, {duration:6});
【问题讨论】:
-
您是否找到了一种无需离开 phonegap 应用即可捕捉视频的方法?我们正在寻求做类似的事情。
-
phonegap 捕获插件
-
我们需要在应用仍在前台使用时捕获视频。另外,您是否找到了同时捕获视频和音频的解决方案?谢谢!
标签: ios objective-c cordova phonegap-plugins