同時使用cordova plugin file transfer,下載文件成功,它沒有任何地方顯示,添加以下代碼:使用此功能,文件下載完成後,止跌下載成功,但視頻沒有顯示在IOS科爾多瓦
var onGetDirectorySuccess = function(fileEntry) {
downloadpostnow(fileEntry, 'http://50.63.14.130/Images/OrderProof/Plugd7a09191-7cdd-4f21-babd-041e3f914ebb.MOV');
}
var onGetDirectoryFail = function(error) {
showError("There is an error while processing your download.",0);
return false;
}
var onRequestFileSystemSuccess = function(fileSystem) {
var entry=fileSystem.root;
entry.getDirectory("plug", {create: true, exclusive: false}, onGetDirectorySuccess, onGetDirectoryFail);
}
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, onRequestFileSystemSuccess, null);
function downloadpostnow(fileEntry, uri){
var fileTransfer = new FileTransfer();
var fileURL = fileEntry.toURL();
var uri = encodeURI(uri);
var uriname = uri.split("/");
uriname = uriname[uriname.length-1];
fileTransfer.download(
uri,
fileURL+uriname,
function (entry) {
alert(JSON.stringify(entry));
//showError("Download Completed.",1);
fileTransfer.abort();
},
function (error) {
fileTransfer.abort();
//showError("There is an error while downloading your post.",0);
return false;
},
true,
{/**/}
);
}
't show in IOS
它存儲在文檔目錄中。可以共享下載的視頻的路徑?你可以使用fileURL。 – KKRocks
file://var/mobile/Containers/Data/Application/some_id/Documents/plug/Plugd7a09191-7cdd-4f21-babd-041e3f914ebb.MOV –
你能澄清一下你在哪裏想看視頻嗎? – dariru