I have problem playing local video on iOS on my Cordova based app. At the beginning I want to stress out that this problem is happening only when I'm using WKWebView, and if UiWebView is used, video plays fine. This is scenario I have:
-User comes to screen to which video url is passed
-Via FileTransfer I download it to phone and store it at desired location
-Using JS video is loaded to <video>
tag and played.
Basically I'm doing everything as described in answer to this SO question. The problem with UiWebView was that if relative path was set to src, video for some reason couldn't be loaded (no matter which combination I used), so this solution worked great for me, because it is based on this line of code:
entry.toURL()
This returns full path of the downloaded video which is great, at least for the UiWebView.
The problem for WkWebView is that entry.toURL() returns smth. like this:
file:///var/mobile/Containers/Data/Application/3A43AFB5-BEF6-4A0C-BBDB-FC7D2D98BEE9/Documents/videos/Dips.mp4
And WKWebView doesn't work with file:// protocol. Also, neither WKWebView works wit relative paths :(
Can anyone help me to fix this ?
AllowInlineMediaPlayback
preference for iOS enabled in yourconfig.xml
. cordova.apache.org/docs/en/latest/config_ref/…. Also, which plugin are you using to enable use of WKWebView? – johnborgesfile:///var/mobile/Containers/Data/Application/A313B954-55C5-49F1-801F-5AF519EA4E8E/Library/files/video/High-Knees.mp4
. And these are combinations which I have tried (non of them worked):http://localhost:12344/Library/files/video/High-Knees.mp4
http://localhost:12344/video/High-Knees.mp4
http://localhost:12344/var/mobile/Containers/Data/Application/A313B954-55C5-49F1-801F-5AF519EA4E8E/Library/files/video/High-Knees.mp4
– hyperN