Search code examples
actionscript-3apache-flexair

How to implement stagevideo in adobe air for android?


I have been developing desktop based app for my customer in Adobe AIR which plays video using mx:videoDisplay and images in a playlist. Now he needs the same app with same code base in AIR for Android as well.

i am able to make the APK of that app. but he wants StageVideo to play the videos. i searched and found this(http://www.adobe.com/devnet/flashplayer/articles/stage_video.html) article and sample code but i could not find this to play in my case. can any one help me out? i am short of time.


Solution

  • From my testing, StageVideo only worked in Android 4.0+. It definitely did not work in 2.3 and I could not get it to run on 3.0, though that may have just been due to the lackluster tablet we had available for testing.

    You must also use either GPU or Direct rendering mode. Using CPU or Auto (which currently defaults to CPU) will not work here. This will also cause some issues since not all Android devices support GPU or Direct rendering and GPU rendering has its own quirks (like not allowing semi-transparent pixels).

    Another thing worth noting: StageVideo is not in the display list. It is rendered directly on the stage, which is below everything. So if you try to place it in your app, everything else on the stage will be covering it. To get around this, I created a custom class that continuously drew out a mask that was then applied to my top-level container. This mask effectively punched a hole through my app so that the video player could be seen.

    StageVideo is undeniable smooth and a great performer, but in the end it is a real pain to implement. Unless your client is absolutely demanding you use it, I suggest sticking to VideoDisplay or making your own video player based on the OSMF packages.