StageVideo on iOS with AIR
I've found it hard to find a recent tutorial apart from this brilliant one by Lee Brimelow: http://www.gotoandlearn.com/play.php?id=134
I'd recommend watching that tutorial first as it explains everything, then if you want to copy the code see below, there's also a zip containing everything (you'll need to follow
Though as the download didn't work and there was nothing specific to iOS I thought i'd type it all out for you and elicit a few details specific to iOS. So you know what i'm using - its AIR 3.2, Flash CS5.5, i've tested it on an iPhone 4 with 5.0 and an iPad with 5.1 - though there's no reason why it shouldn't work on anything above 4.0 as far as i know. If you want to update your SDK to 3.2 then follow the instructions here (http://helpx.adobe.com/x-productkb/multi/overlay-air-sdk-flash-professio... - but use player tag 15 for AIR 3.2).
Here's some iOS settings:
In your "AIR for iOS Settings..." set "Rendering" to "GPU"
Under "Included files:" click on the plus and include your video, remember to change the name of vid.mp4 below to whatever yours is.
You will find that the simulator within flash wont play StageVideo, it will use the alternative "Video" - you can test this by removing the else statement under "if(stageVideoAvail)" - this will show nothing in the simulator but will work on your device. I'm getting an error in the simulator when the video reaches the end, I suspect that there's a missing event handler for this, i'll update soon on that.
To encode the video, thanks to Antonia Holguin who posted some settings that work well: http://swfhead.com/blog/?p=1617
Using After Effects these settings worked well (use them as a starting point perhaps):
• TV Standard: NTSC
• Profile: Baseline
• Level: 3.1
• Bitrate: CBR at 1.1
here's the code, make this the Document class of your flash file:
public class main extends Sprite
private var stageVideoAvail:Boolean;
private var sv:StageVideo;
public function main()
private function onAvail(e:StageVideoAvailabilityEvent):void
stageVideoAvail = (e.availability == StageVideoAvailability.AVAILABLE);
private function initVideo():void
var nc:NetConnection = new NetConnection();
var ns:NetStream = new NetStream(nc);
ns.client = this;
sv = stage.stageVideos;
var vid:Video = new Video(1024, 768);
private function onRender(e:StageVideoEvent):void
sv.viewPort = new Rectangle(0, 0, 1024, 768);
public function onMetaData(e:Object):void
public function onXMPData(e:Object):void