Phonegap:如何获取捕获视频的实际宽度和高度

时间:2014-03-28 21:52:29

标签: cordova video-capture

我试图获得宽度和宽度。通过phonegap捕获的视频的高度。无论我的iphone在拍摄视频时是纵向还是横向,宽度/高度输出始终为480x360。知道为什么吗?

 captureSuccess: function(mediaFiles) {
    var path, mediaFile;
    path = mediaFiles[0].fullPath;
    mediaFile = mediaFiles[0];
    mediaFile.getFormatData(function(mediaFileData) {
        console.log(mediaFileData);
        //output for mediaFileData : {"width":480,"duration":1.478333,"bitrate":0,"codecs":null,"height":360}
    }, function(error) {
        console.log(error);
    });
 }

1 个答案:

答案 0 :(得分:1)

试试这个

$("<video/>").attr("src", "VIDEO_PATH").on('loadedmetadata', function() {
    var dimensions = [this.videoWidth, this.videoHeight];
    alert(dimensions);
});