5 Replies Latest reply on Nov 26, 2014 7:59 AM by sinious

    How to play a video in AIR on a mobile device

    DJ Gecko Level 1

      Does anyone have any walkthrough they can share for how to play a video in an mobile AIR app? This would be for a video that's bundled with the air app.

       

      Thanks!

        • 1. Re: How to play a video in AIR on a mobile device
          sinious Most Valuable Participant

          A few details would make the answer more valid. Things like, which mobile devices are you targeting? Certain devices have strengths and weaknesses. I realize you want to play bundled video and this doesn't apply but NetStream does not return a bytesLoaded used with StageVideo (GPU accelerated video) on iOS making streaming videos difficult to build controls for (can't determine seeking range). Some versions of OS's can play video in the StageWebView with native HTML5 controls and others cannot (like Android prior to KitKat for the most part, the results are entirely erratic). iOS 8.1 / Apple are going to require apps support 64bit, taking some ANE choices that handle video off the table until they may or may not be updated.

           

          If you're targeting multiple OS's then the solution is likely to require multiple approaches.

          1 person found this helpful
          • 2. Re: How to play a video in AIR on a mobile device
            DJ Gecko Level 1

            Thanks for your response. I'm looking for tutorials and documentation for playing video in an AIR app on Android and iOS, including OSes and devices that are a year old to present.

             

            Thanks.

            • 3. Re: How to play a video in AIR on a mobile device
              sinious Most Valuable Participant

              Since the video is bundled, I'd recommend you make usage of the GPU accelerated StageVideo class:

              StageVideo - Adobe ActionScript® 3 (AS3 ) API Reference

               

              On that page you will find several tutorial and code links (under the description) on how to use it, for example:

              Adobe Flash Platform * Using the StageVideo APIs

              Getting started with stage video | Adobe Developer Connection

               

              The basics about it is if you have ever created a video player using NetStream and NetConnection then you already know how to use it. After the event fires indicating if StageVideo is available you can make use of it or determine if you need a fallback (regular Video with software rendering).

               

              Unlike just using the FLVPlayback component, you must create and attach your own video controls. Again if you've ever made a custom player with NC/NS classes above then chances are you've made custom controls. Just whichever buttons you desire for your functionality (play/pause, seek, volume, etc).

               

              It's worth repeating, I'm only recommending this because I choose this method with bundled videos. If you need to stream, NetStream will not give you the information you need for buffering/seeking. In that scenario I resort to using StageWebView on iOS which embeds a native HTML5 MP4 playback control. I actually start receiving the stream to get the metadata (video size) and generate a HTML page with a <video> tag that makes the video an appropriate size. Video in StageWebView does not work well (especially Flash video) on Android prior to KitKat so I avoid that and use StageVideo, which works great.

              1 person found this helpful
              • 5. Re: How to play a video in AIR on a mobile device
                sinious Most Valuable Participant

                Sorry I get busy right around the holidays (don't we all ). You're welcome and good luck!