简体   繁体   English

下载成功,但视频未在IOS Cordova中显示

[英]download success but video don't shows in IOS cordova

while using cordova plugin file transfer , download file successfully, it didn't shows anywhere, code added below: 使用cordova插件文件传输时 ,成功下载文件,但未在任何地方显示,下面添加了代码:

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,
    {/**/}
);
}

using this function, file download complete, it wouldn't show in IOS 使用此功能,文件下载完成,不会在IOS中显示

If you want to show downloaded video . 如果要显示下载的视频。

Here is what I do: 这是我的工作:

  1. (once!) Make sure all hidden files are visible on your Mac: In terminal window run: defaults write com.apple.Finder AppleShowAllFiles YES (一次!)确保所有隐藏文件在Mac上均可见:在终端窗口中运行:默认写com.apple.Finder AppleShowAllFiles是

  2. While in Xcode, open Organizer -> Devices, find your iPhone and from their find your application in Applications folder. 在Xcode中,打开管理器->设备,找到您的iPhone,然后在“应用程序”文件夹中找到它们的应用程序。

  3. At the bottom click Download and download the application to your desktop (anywhere) 单击底部的下载并将应用程序下载到桌面(任何位置)

  4. Open Finder, navigate to the downloaded file, right click on it and select Show Package Contents. 打开Finder,导航到下载的文件,右键单击它,然后选择“显示软件包内容”。 The view will change to standard finder view with open files in that app. 该视图将更改为带有该应用程序中打开文件的标准finder视图。 (Follow url file path) (遵循url文件路径)

  5. Go to the Documents folder, find your *.MOV file, right click on it and choose Open With -> Other. 转到Documents文件夹,找到* .MOV文件,右键单击它,然后选择Open With-> Other。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM