OGeek|极客世界-中国程序员成长平台

标题: ios - 是否支持在 phonegap (cordova) 中使用声音捕获视频? [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-12 15:38
标题: ios - 是否支持在 phonegap (cordova) 中使用声音捕获视频?

是否支持在 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});



Best Answer-推荐答案


当然。可以使用 Phonegap 的“Capture”API 捕获视频和声音。参见文档 here .

根据评论编辑:

您永远不会告诉设备捕获音频。视频和音频的捕获是不同的操作。您还需要调用 navigator.device.capture.captureAudio 函数。见 here .

关于ios - 是否支持在 phonegap (cordova) 中使用声音捕获视频?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19401126/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://ogeek.cn/) Powered by Discuz! X3.4