Skip to main content
Participant
January 8, 2012
解決済み

StageWebView local video file <> NativeExtension to launch media player (Android)

  • January 8, 2012
  • 返信数 2.
  • 2398 ビュー

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!

このトピックへの返信は締め切られました。
解決に役立った回答 alad-1234

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

返信数 2

Participant
April 2, 2012

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

Participant
February 21, 2012

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.

alad-1234作成者解決!
Participant
February 24, 2012

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