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 ()