h5+ IOS app to determine if a local file exists Plus.io.resolveLocalFileSystemURL ()

Source: Internet
Author: User

Problem Description: The first page of video after loading saved to the local phone, the second load to determine whether the video file exists, the presence of direct read, does not exist then go to the server to download and save to Local. Android platform is normal, iOS has been unable to accurately determine whether the file exists, tested even if the file exists also prompt does not exist ...

WORKAROUND: After the query, you will be able to pass the URL parameter to add a prefix "file:", the code is as follows

//determine if the video existsPlus.io.resolveLocalFileSystemURL ("File:" + Sd_path,function(Entry) {Entry.file (function(file) {videomedia.src=Sd_path; Videomedia.autoplay=true; Videomedia.controls=false;                    Videomedia.load ();                }); }, function(e) {//Download Video Resources                    varDtask = plus.downloader.createDownload (Common.global_url + jsondata[0].vdolink, {"FileName": Hb_path,"Timeout": 10,                        "Retry": 2                    }, function(d, status) {if(Status = = 200) {videomedia.src=Sd_path; Videomedia.autoplay=true; Videomedia.controls=false;                        Videomedia.load (); } Else {                            //Direct Jump Homemui.openwindow ({URL:' Webview_main.html ', ID:' Webview_main.html ', preload:true, show: {anishow:' Pop-in '}, waiting: {Autosh OW:false                                }                            });                    }                    });                Dtask.start (); });

Reference Link: Https://stackoverflow.com/questions/21980112/cordova-resolvelocalfilesystemurl-success-call-back-failing-on-ios

https://issues.apache.org/jira/browse/CB-6116

h5+ IOS app to determine if a local file exists Plus.io.resolveLocalFileSystemURL ()

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.