Ich habe eine mobile App (mit ionic/cordova) erstellt, die eine mp4-Datei herunterlädt. Ich habe es in Android gemacht, aber kein Glück in iOS. Sonderbare Sache ist, dass es manchmal funktioniert, manchmal nicht (nur in iOS). Ich habe das Plugin cordova-plugin-file-transfer
verwendet, wenn es funktioniert, es funktioniert perfekt. Aber wenn ich den Fehler aufmerksam machen, erhalte ich folgende:
kann nicht Pfad erstellen heruntergeladene Datei zu speichern: Sie stehen ganz keine Berechtigung, die Datei
Fehlercode zu speichern: 1
hier ist mein Code ein:
$scope.download = function(){
var downloadProgress ='';
var url = "http://www.sample-videos.com/video/mp4/720/big_buck_bunny_720p_5mb.mp4";
var MyFiles = cordova.file.dataDirectory + 'test1.mp4';
$cordovaFileTransfer.download(url,MyFiles,{}, true).then(
function(result){//success download
$ionicLoading.hide();
var alertPopup = $ionicPopup.alert({
title: 'Download Successful!',
});
}, function(error){
var alertPopup = $ionicPopup.alert({
title: 'Error',
template: JSON.stringify(error)
});
}, function(progress){
$timeout(function() {
downloadProgress = (progress.loaded/progress.total) * 100;
});
$ionicLoading.show({
template: 'Download in progress please wait<br/><progress id="progressbar" max="100" value="'+ downloadProgress +'"> </progress>' +
'<div id="progressbarlabel">' + Math.ceil(downloadProgress) + '%</div>'
});
});
}
kann Gebrauch cordova.file.externalRootDirectory sein, dass der Ort, um die Bilder im Gerät –
nah zu speichern ich bereits alle das Verzeichnis verwendet –