我是cordova& amp;的新手在Android中遇到Cordova Camera plugin
的问题。
在Android中播放视频时,会捕获视频。以纵向模式保存,但我上传后的网址是横向模式:
视频捕获方法:
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);
}
}
Video File I am getting from server
答案 0 :(得分:0)
我彻底检查了我的代码,发现用于文件上传的API正在改变视频从纵向到横向的方向。
所以文件上传代码是正确的。
感谢您考虑问题