1

我是科尔多瓦的新手,Cordova Camera plugin在 Android 中遇到了一些问题。

在 Android 中拍摄视频时,会以纵向模式捕获并保存视频,但上传后获得的 url 是横向模式:


视频拍摄方法:

Myscript.SocialVideocapture = function(){
var ramv;
var options = {
limit: 1,
duration: 100000000

};

navigator.device.capture.captureVideo(onSuccess, onError, options);

function onSuccess(mediaFiles) {

    VideoEditor.createThumbnail(
    trimSuccess, // success cb
    trimFail, // error cb
    {
    fileUri: mediaFiles[0].fullPath, // the path to the video on the device
    outputFileName: 'output-name', // the file name for the JPEG image
    atTime: 2, // optional, location in the video to create the thumbnail (in seconds)
    width: 320, // optional, width of the thumbnail
    height: 480, // optional, height of the thumbnail
    quality: 100 // optional, quality of the thumbnail (between 1 and 100)
    }
    );

    ramv=mediaFiles[0].fullPath;
    var cvid=Math.floor((Math.random() * 1000000) + 1);
    socialvideosendurl=mediaFiles[0].fullPath;

}

function onError(error) {


} 
}

文件上传方式:

Myscript.Socialsendtoserver = function(event) {



if ($$("#statusbox").val() == '') {
    Appyscript.alert('Please Enter Status', 'Alert!');


} else {

    Appyscript.showIndicator();

    var sfilekey;
    var smimeType;
    var sspath;

    if (socialvideosendurl === undefined || socialvideosendurl === '') {

        sfilekey = "file";
        smimeType = "text/plain";
        sspath = localStorage.getItem("dummysocial");

    } else {

        sfilekey = "video";
        smimeType = "video/quicktime";
        sspath = socialvideosendurl;

    }


    var options = new FileUploadOptions();
    options.fileKey = sfilekey;
    options.fileName = sspath.substr(sspath.lastIndexOf('/') + 1);
    options.mimeType = smimeType;
    var params = new Object();

    options.params = params;
    params.appId = appId;
    params.userId = localStorage.getItem("userid");
    params.status = $$("#statusbox").val();
    params.tag = "myimage";
    params.image = JSON.stringify(sendsoimages);
    params.actionType = "addPost";

    options.params = params;

    options.chunkedMode = false;

    var ft = new FileTransfer();


    ft.upload(sspath, site_url + '/webservices/SocialNetworkPost.php', win, fail, options);


}

}

上传的原始视频文件

我从服务器获取的视频文件

  • 这是我的代码中的服务器端问题还是问题?
4

1 回答 1

0

我彻底检查了我的代码,发现用于文件上传的 API 正在将视频的方向从纵向更改为横向。

所以文件上传代码是正确的。

感谢您考虑问题

于 2016-11-28T10:03:27.803 回答