Skip to main content
Known Participant
October 12, 2011
Question

AIR3 & H264 through Stagevideo iPad2 / Android

  • October 12, 2011
  • 13 replies
  • 8483 views

Hello,

I am struggling on displaying H264 .mp4 videos through ipad2 and Xoom tablet for a while.

Parameters under FDT4:

     - AIR3 SDK (latest)

     - Flex SDK (latest)

     - swf-version = 13

     - targetplayer=11

Stagevideo is successfuly instanciated, but nothing...

I tried several HD formats, through several containers (f4v, h264) and still nothing.

I know that some people got result but so many people have trouble with this new feature which should be great.

My question is simple:

is there any tutorial that clears the usage of the StageVideo on Mobile ?

thanx.

Arthy

This topic has been closed for replies.

13 replies

Participant
October 20, 2011

I would like to see a sample code if possible, ty.

Participant
October 18, 2011

I have been having the same issue. only thing that has worked is StageWebView but once the video is launched there is no way to get back to the app unless you quit the app. How can a video be opened using the native IOS player on flash 5.5 ?

var webView = new StageWebView();

webView.stage = this.stage;

webView.viewPort = new Rectangle( 0, 0, stage.stageWidth, stage.stageHeight);

var path:String = new File(new File("app:/video/vide_name.mp4").nativePath).url;

webView.loadURL(path);

October 19, 2011

I recommend using StageVideo rather than StageWebView for video playback. I can help you out if you post your code ? Does it crash for you too or is it just not playing ?

Whats the renderMode, swf-version ?

Known Participant
October 20, 2011

Hello,

I finally did it !!! what a relilef !!!!!

In fact everything went ok since you respect the following point :

AS3:

     - use any stagevideo creation workflow (wait stage event, create stagevideo instance...)

     - compile for "-target-player=11.0" (dont know if this one is really necessary)

     - compile for "-swf-version=13"

AIR descriptor (app.xml) :

     - set wmode to "direct"

I was preparing a zip example for this issue by playing a mp4 on my server on iPad2, but it worked at first try ......

But once included in my project, it crashed again.....

In fact i found out that the NetStream could not play my .mp4 since i try to play a MP4 video stored in the File.applicationStorageDirectory !

So I tested the following mp4 locations :

     - distant video :

               protocol : HTTP://

               example: http://www.mysite.com/video.mp4 

               verdict : works fine

     - local file in File.applicationDirectory (embeded in .apk or .ipa file)         

               protocol : app://

               example: app://video.mp4 

               verdict : works fine

     - local file in File.applicationStorageDirectory (not embeded in .apk or .ipa file)         

               protocol : app-storage://

               example: app-storage://video.mp4 

               verdict : NOT WORKING AND CRASHS APPLICATION

Finally i used the stagewebview trick to change the file url from "app-storage://" to "file:///" url format, and that was a success

The trick is :

var videoFile : File = File.applicationDirectory.resolvePath("myvideo.mp4");

var videoPath : String = new File(new File(_videoFile.url).nativePath).url; // get a file:/// video path to mp4

myNetStream.play(videoPath);

I don't really know if we may call it a bug since playing a video in app:// directory works fine, but not in storage-app:// (maybe sandbox restriction or something else).


Hope this will help


Adobe Employee
October 16, 2011

You can get a full tutorial about StageVideo here. It also contains sample code to hep you out. I hope this helps you out.

Known Participant
October 17, 2011

Sorry for late answer,

@meetshah4288: i will try to put some code to show you (ipad2 app just crash when playing mp4)

A friend managed to play a mp4 video on iphone with osmf player.

I used his video and included the osmf player, but ipad2 app still crashes.

@Vincent35: unfortunately, i created an as3 project (not flex)

@Varun Bhatia: yes these tutorial are ok for web development, but mobile environment is quite different through AIR3.

Thanks for your help, i will get back on this soon.

Cheers.

October 12, 2011

If you hear audio but video is not visible and you are using Flex application then you need to change the backgroundAlpha to 0 in your main component.

Have you kept renderMode as direct ?

Can you paste in your code here ?

Thanks,

Meet

Inspiring
October 12, 2011

I confirm that putting backgroundAlpha to 0 for the main component works fine, i have now a beautiful h264 video in my app on Android device, Xoom, and iPad 1; with rendermode to "direct".