0
我想用我的應用程序使用Cordova Media Capture短視頻剪輯。由於這些視頻很短,我不想將它們保存在用戶手機上。該API似乎也沒有指定一個選項來做到這一點。我將如何實現這樣的事情?如何使科爾多瓦媒體捕獲不保存到畫廊
我想用我的應用程序使用Cordova Media Capture短視頻剪輯。由於這些視頻很短,我不想將它們保存在用戶手機上。該API似乎也沒有指定一個選項來做到這一點。我將如何實現這樣的事情?如何使科爾多瓦媒體捕獲不保存到畫廊
您可以使用cordovaFileTransfer插件將捕獲的視頻文件發送到您的首選位置。
$scope.captureVideo = function() {
var options = { limit: 3, duration: 15 };
$cordovaCapture.captureVideo(options).then(function(videoData) {
// Success! Video data is here
/** following is sample usage to upload the video to server.**/
path = videoData[0].localURL;
var options = new FileUploadOptions();
options.fileKey = "uploadfile";
options.fileName = videoData[0].name;
options.mimeType = "video/mp4";
$cordovaFileTransfer.upload("video-upload-url", path, options).then(function (result) {
//Success! Video file uploaded to destination.
}, function (err) {
console.log(err);
},
function (progress) {
if (progress.lengthComputable) {
} else {}
});
}, function(err) {
// An error occurred. Show a message to the user
}); }
https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-media-capture/
https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-file-transfer/index.html