Copy link to clipboard
Copied
Hello there!
As discussed here
http://forums.adobe.com/message/4090326
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.
Short description:
- 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.
if yes:
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.debug/Local%20Store/video/video.mp4">
</video>
</div></body></html>
=> this is not working. Feels like the StageWebView can not access the file (permissions? wrong path?)
if not:
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!
Regards!
1 Correct answer
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 StageWeb
...Copy link to clipboard
Copied
I am in the same boat you are alad, a solution to this would be awesome. Interesting that local video in iOS with webView works so easy.
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
Hi alad.
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)
Cheers
