As discussed here
it's very hard to load (for example) a local videofile saved on the device inside an HTML5 video-Tag.
All the possible solutions I found and tried didn't work for me.
- user can stream an mp4-video via http://....
- if he wants, the user can download this video into the folder File.applicationStorageDirectory (also tried documentsDirectory, userDirectory)
- user can then watch the video without internet connection
When the users wants to start the video, the app checks if the video is available local.
StageWebView is loaded with the code
<html><head><title>Player</title></head><body><div style="position:relative;width:800px;margin:0 auto;">
<video id="player" autobuffer controls height="400" width="800" onclick="this.play();">
<source src="file:///data/data/air.com.test.testApp.debug/com.test.testApp.de bug/Local%20Store/video/video.mp4">
=> this is not working. Feels like the StageWebView can not access the file (permissions? wrong path?)
the http-Url is used as source for the video tag => this is working
As a solution I'm thinking of starting the native video player to play the local file.
navigateToURL doesn't work...
Perhaps I need a native extension to start the player?
Is there any solution out there?
Thank you very much in advance!
Finally I found a solution...
The problem is that AIR on Android stores the application data in the protected directory /data/... which is not accessible by StageWebView (or any browser app).
So you have to copy the video file you want to play to a temporary pubic directory on the sd-card for example and use this in StageWebView.
You also have to create a temporary html-page with the video-tag and load this page in StageWebView (not the string) because external resources are only loaded in StageWebView when using an URL.
On iOS the application storage directory is readable for StageWebView so you don't have to do this step.
Hope this helps
Nice that you`ve figured it out, however i still have problems to make it work.
Can you share some code you`ve developed (html page, loading instructions including paths, and paths of video)