2017-05-22 12 views
0

同時使用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

+0

它存儲在文檔目錄中。可以共享下載的視頻的路徑?你可以使用fileURL。 – KKRocks

+0

file://var/mobile/Containers/Data/Application/some_id/Documents/plug/Plugd7a09191-7cdd-4f21-babd-041e3f914ebb.MOV –

+0

你能澄清一下你在哪裏想看視頻嗎? – dariru

回答

0

如果你想顯示下載的視頻。

這裏是我做的:(!一次)

  1. 確保所有隱藏文件是你的Mac上可見: 在終端窗口中運行: 默認寫com.apple.Finder AppleShowAllFiles是

  2. 在Xcode中,打開管理器 - >設備,找到您的iPhone並從他們的應用程序文件夾中找到您的應用程序。

  3. 在底部點擊下載和下載應用程序到您的桌面(任何地方)

  4. 打開Finder,瀏覽到下載的文件,右鍵單擊它並選擇顯示包內容。該視圖將更改爲標準的查找器視圖,並在該應用中打開文件。 (按照url文件路徑)

  5. 轉到Documents文件夾,找到* .MOV文件,右鍵單擊它並選擇Open With - > Other。

+0

感謝您的重播,但我的意思是視頻不在設備中顯示,如:在照片 –

+0

您需要將視頻寫入圖庫。 – KKRocks

+0

嘗試在谷歌搜索UISaveVideoAtPathToSavedPhotosAlbum。 – KKRocks

相關問題