Home > Flash development > AIR 3 enables hardware decoding of H.264 video in iOS apps

AIR 3 enables hardware decoding of H.264 video in iOS apps

Previously it was not possible to achieve hardware decoding of streaming H.264 video in AIR-made apps on iOS, perhaps served in a multi-bitrate manner . I KNOW, huh? It is, in fact, a very specific requirement for achieving quality video playback on devices. And it is now possible because of AIR 3 and a few other technologies that have been released recently by Adobe.

First of all there is OSMF 1.6 which was release a couple weeks ago. As far as iOS is concerned, the most important feature here is the seamless support of StageVideo. This enables close-to-metal high-performance hardware-decoded hardware-rendered video. Within the context of an AIR application there are a couple boilerplate items, in addition to using OSMF ver1.6 to playback your video, that you need to add to your AS3 or Flex project in order to enable this performance.

  1. add this compiler argument to ensure it targets Flash Player 11:
    -swf-version=13
  2. set the rendermode item in the app descriptor file to “gpu” or “direct”
    <renderMode>gpu</renderMode >

Secondly, and it’s a biggie, is that you need to point to a streaming service using the recently released FMS 4.5. It is the support for Apple’s HLS (HTTP Live Streaming) support that is required. (By the way, the “Live”, as in rhyming with “hive”, refers to VOD as well as Live. I like to think of it as that which rhymes with “give” and I am less confused). And since you have access to the latest greatest FMS technology you may as well use a manifest file and several versions of the video encoded at different bit rates to take advantage of the dynamic-mutlibitrate-switching support made possible by various parts of this technology stack. OSMF makes this easy by accepting a URL pointing to the manifest file and everything is taken care of.

The final ingredient is AIR 3. FMS 4.5 can be used to stream video directly to iOS using mobile safari which is a great solution, but the user is presented with the default iOS video player. Perhaps you want to provide a customized video experience and an app made with AIR is just what you need. AIR version 3 to be more precise. With the Flash api at your disposal, so much is possible. AIR 3, released this week, is the final enabling piece of the puzzle in achieving in-app video nirvana on an iPad. Use AS3-only or Flex Mobile projects with Flash Builder to build an awesome and unique video service, and AIR 3 to package it up and sell it on the app-store.

Categories: Flash development Tags:
  1. Marius-Remus Mate
    October 9th, 2011 at 15:49 | #1

    To target Flash Player 11, this is the correct parameter
    -swf-version=13

    Refer to this white paper for the difference between SWF version and player version.

  2. Marius-Remus Mate
    October 9th, 2011 at 15:49 | #2
  3. October 9th, 2011 at 16:06 | #3

    Thanks! I updated the post.

  4. November 4th, 2011 at 02:52 | #4

    renderMode=gpu is for Android
    renderMode=direct is for iOS
    Puting “gpu” for iOS devices won’t enable it. It has to be “direct” to enable it on iOS.

  5. November 4th, 2011 at 03:38 | #5

    I did some tests and this is what I found:
    - renderMode: “gpu” is only for Android devices
    - renderMode: “direct” is for iOS devices
    To enable the hardware decoding on iOS renderMode must be “direct”. “gpu” works only with Android.

  6. November 4th, 2011 at 08:26 | #6

    Yeah HLS on IOS rocks with AIR!
    Just to add to this you can also use Wowza to do the streaming or i think any other server which can server HLS streams so you`re not limited to FMS which makes it even better!

    Benz

  7. superabe
    November 9th, 2011 at 20:42 | #7

    Did you seriously manage to get an AIR for IOS app to playback an HLS (.m3u8) file streaming off of FMS4.5 ? If you don’t mind, could you share the FXP for such a project. I been banging my head against the wall with this for some time and would sure appreciate it.

  8. January 18th, 2012 at 21:14 | #8

    Just FYI…
    Not sure what the differences are but im finding the following…
    - Setting gpu is enabling hardware rendering for me on iPad2.
    - Setting direct does not enable hardware rendering on iPad2.
    I can clearly see a difference in performance between these 2 settings. Perhaps this is a recent change in AIR 3? From what I’ve read the only value that’s honored for renderMode is gpu. Anything else and it defaults to the standard rendering.

    I am compiling from FlashBuilder 4.5 with the AIR 3 SDK and targeting FP11 on iOS. Testing on iPad2.

  1. October 26th, 2011 at 02:50 | #1