我正在使用 ng-cordova 的插件捕获从手机捕获离子框架内的( https://github.com/apache/cordova-plugin-media-capture ) 视频。
$scope.captureVideo = function() {
var options = { limit: 1, duration: 10 };
$cordovaCapture.captureVideo(options).then(function(videoData) {
var i, path, len;
for (i = 0, len = videoData.length; i < len; i += 1) {
path = videoData[i].fullPath;
console.log("Path of the video is = " + path.toString());
}
}, function(err) {
// An error occurred. Show a message to the user
});
}
问题是我拍摄的每一个视频都会保存到我不想要的手机图库中。如果我捕获图像,它不会保存到我手机的图库中,这正是我想要的视频捕获。有没有办法阻止视频被保存?
我尝试删除该文件,但显然视频文件未保存在 cordovafile 目录中。
function DeleteFile() {
var filename = "20161024_095758.mp4";
var relativeFilePath = "file:/storage/C8F0-1207/DCIM/Camera";
console.log('data directory: '+cordova.file.dataDirectory);
window.resolveLocalFileSystemURL(relativeFilePath, function(dir) {
dir.getFile(filename, {create:false}, function(fileEntry) {
fileEntry.remove(function(){
alert('file removed');
// The file has been removed succesfully
},function(error){
alert('error'+JSON.stringify(error));
// Error deleting the file
},function(){
alert('file doesnt exist');
// The file doesn't exist
});
});
});
上面删除文件的代码导致错误代码:6。不允许修改