• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
Locked
2

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

Community Beginner ,
Jan 08, 2012 Jan 08, 2012

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!

TOPICS
Development

Views

2.3K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Beginner , Feb 24, 2012 Feb 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 StageWeb

...

Votes

Translate

Translate
Explorer ,
Feb 21, 2012 Feb 21, 2012

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 24, 2012 Feb 24, 2012

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 01, 2012 Apr 01, 2012

Copy link to clipboard

Copied

LATEST

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines