19 Replies Latest reply: Jul 21, 2012 5:31 PM by M0N5TERS RSS

    StageVideo on iOS

    KarelBrascamp Community Member

      Hi all,

       

      It would be so great if there would be stagevideo support for iOS devices. I know there's a workaround using StageWebView, but I need to be able to place objects on top of the video.

      Does anyone know if, and if so, when Adobe plans to release support for StageVideo on iOS?

       

      Regards,

       

      Karel

        • 1. Re: StageVideo on iOS
          relaxatraja Community Member

          You can do call the native video player from the IOS using stagewebview and play H.264 videos.

          • 2. Re: StageVideo on iOS
            KarelBrascamp Community Member

            Thanks, but using the stagewebview workaround, I'm not able to put flash objects on top of the video. And I need that for my application..

            • 3. Re: StageVideo on iOS
              relaxatraja Community Member

              I think its possible if you not occupy the whole stage width and height. and you can use the space for your purpose?

              • 4. Re: StageVideo on iOS
                KarelBrascamp Community Member

                Nope, I need to place objects on top of the video. Wich according to the documentation, doesn't seem possible:

                 

                'The StageWebView instance attached to a stage is displayed on top of any Flash display objects' (source)

                 

                Cheers,

                 

                Karel

                • 5. Re: StageVideo on iOS
                  sebelga Community Member

                  Hello,

                  I'm trying to do the same thing with the new AIR 3 beta 2 in Adobe Labs. With the new stagevideo API available for iOS we should be able to play a h264 movie. I'm trying it on a iPad 1 with iOS 4.3.5 with no luck. I get the sound playing, but no video. I do get the "Accelerated" with GPU though....

                   

                  Have you tried it yourselft with better results?

                  thanks..

                  sebastian

                  • 6. Re: StageVideo on iOS
                    loic_digitas Community Member

                    Hello Sebelga,

                     

                    I'm trying the same thing than you with an iPad 1 with iOS 4.3.3 and I have the same result. I have the sound but no video with the gpu render mode.

                    Adobe, do you know if it's a known issue with the iPad 1 ?

                     

                    Thank you

                    Loïc

                    • 7. Re: StageVideo on iOS
                      sebelga Community Member

                      I created a bug at Adobe. You will find there a zip file with the test project I did.

                      At the end I could see a portion of the video "outside" the stage.. Check it to understand.

                       

                      https://bugbase.adobe.com/index.cfm?event=bug&id=2960080

                       

                      seb

                      • 8. Re: StageVideo on iOS
                        KarelBrascamp Community Member

                        I actually managed to do it, targeting flash player 11, and packaging with the Adobe Air 3.0 RC sdk.

                        • 9. Re: StageVideo on iOS
                          Arthy the crab

                          @karelBrascamp : Is it possible to get your example files ? i spent my week end trying to do it on android + ipad2... (i successfully traced the runtime as the latest airt3 beta, but still no stagevideo available)

                          • 10. Re: StageVideo on iOS
                            Arthy the crab Community Member

                            Ok i did successfully in integrating VideoStage and play accelerated video, but performance are very bad and far from expected, even if followed adobe recommandation from Adobe AIR TV article : http://www.adobe.com/devnet/devices/articles/video_content_tv.html.

                            • Video codec: H.264, Main or High profile, progressive encoding
                            • Resolution: 720i, 720p, 1080i, or 1080p
                            • Frame rate: 24 or 30 frames per second
                            • Audio codec: AAC-LC or AC3, 44.1 kHz, stereo
                            • Combined bit rate: up to 2Mbps (or higher depending on available bandwidth)
                            • Audio bit rate: up to 192 kbps
                            • Pixel aspect ratio: 1 × 1

                             

                             

                            performance on Xoom tablet are not good. Did someone managed in configuring AIR3 app + video encoding to fit expected results (0% CPU, and 100% GPU video decoding as i understood) ????

                            • 11. Re: StageVideo on iOS
                              BoogieBot Community Member

                              Hey guys, I've put together an iOS Stage Video class that works great on iPad/iPad2 (have yet to test it on my iPhones), this should help you out! It's not perfect, but it works like a charm!

                               

                              You will have to add in the following compiler arguments to your Flex project:

                              -swf-version=13 -target-player=11.0

                              and in your app descriptor file set the rendermode to 'direct'

                              <renderMode>direct</renderMode>

                              you must also set the 'backgroundAlpha' to 0 on your main component

                               

                              usage:

                              --------

                               

                               

                               

                               

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

                              var vid:iOSStageVideo = new iOSStageVideo( path , 1024 , 768 );

                              vid.addEventListener('videoDone' , function():void{

                              vid.stopVideo();

                              container.removeChild( vid );

                              removeElement( container );

                              });

                              container = new UIComponent();

                              container.width = stage.stageWidth;

                              container.height = stage.stageHeight;

                              addElement( container );

                               

                              container.addChild( vid );

                               

                               

                               

                               

                               

                               

                              and here is the class:

                              ---------------------------

                               

                               

                               

                               

                               

                               

                              package

                              {

                                        import flash.display.Sprite;

                                        import flash.display.StageAlign;

                                        import flash.display.StageQuality;

                                        import flash.display.StageScaleMode;

                                        import flash.events.Event;

                                        import flash.events.NetStatusEvent;

                                        import flash.events.StageVideoAvailabilityEvent;

                                        import flash.events.StageVideoEvent;

                                        import flash.geom.Rectangle;

                                        import flash.media.StageVideo;

                                        import flash.media.StageVideoAvailability;

                                        import flash.media.Video;

                                        import flash.net.NetConnection;

                                        import flash.net.NetStream;

                               

                               

                                        [Bindable]

                                        public class iOSStageVideo extends Sprite

                                        {

                                                  private var videoPath:String;

                                                  private var videoWidth:Number;

                                                  private var videoHeight:Number;

                                                  private var _sv:StageVideo;

                                                  private var _vd:Video;

                                                  private var _obj:Object;

                                                  private var _ns:NetStream;

                               

                                                  public function iOSStageVideo( path:String , w:Number , h:Number ){

                                                            videoPath = path;

                                                            videoWidth = w;

                                                            videoHeight = h;

                                                            addEventListener(Event.ADDED_TO_STAGE, onAddedToStage);

                                                  }

                               

                                                  //stage is ready

                                                  private function onAddedToStage(e:Event):void{

                                                            stage.scaleMode = StageScaleMode.NO_SCALE;

                                                            stage.align = StageAlign.TOP_LEFT;

                               

                                                            var nc:NetConnection = new NetConnection();

                                                            nc.connect(null);

                               

                                                            _ns =  new NetStream(nc);

                                                            _obj = new Object();

                               

                                                            _ns.client = _obj; _ns.bufferTime = 2;

                                                            _ns.client = _obj;

                               

                                                            _obj.onMetaData = MetaData;

                               

                                                            _sv = stage.stageVideos[0];

                                                            _sv.viewPort = new Rectangle(0, 0, videoWidth , videoHeight );

                                                            _sv.attachNetStream(_ns);

                               

                                                            playVideo();

                                                  }

                               

                               

                                                  //video is ready, play it

                                                  //public, can be called externally

                                                  public function playVideo():void{

                                                            _ns.play( videoPath );

                                                            _ns.addEventListener(NetStatusEvent.NET_STATUS, videoStatus);

                                                  }

                               

                                                  //required metadata for stagevideo, even if not used

                                                  private function MetaData(info:Object):void{ }

                               

                                                  //get video status

                                                  private function videoStatus(e:NetStatusEvent):void{

                               

                                                            switch(e.info.code){

                                                                      case "NetStream.Play.StreamNotFound":

                                                                                //do something

                                                                                break;

                                                                      case "NetStream.Play.Start":

                                                                                //do something

                                                                                break

                                                                      case "NetStream.Play.Stop":

                                                                                stopVideo();

                                                                                break;

                                                                      case "NetStream.Buffer.Empty":

                                                                                //do something

                                                                                break;

                                                                      case "NetStream.Buffer.Full":

                                                                                //do something

                                                                                break;

                                                                      case "NetStream.Buffer.Flush":

                                                                                //do something

                                                                                break;

                                                            }

                                                  }

                               

                                                  //stop and clear the video

                                                  //public, can be called externally

                                                  public function stopVideo():void{

                                                            _ns.close();

                                                            _ns.dispose();

                                                            dispatchEvent( new Event('videoDone', true ) );

                                                  }

                                        }

                              }

                              • 12. Re: StageVideo on iOS
                                billo Community Member

                                Can someone please provide a Flash Professional CS5.5 solution for StageVideo on iOS.  A FLA file would be preferred.  I have used StageWebView successfully on an iPad.  I have tried using various document classes but cannot get the video file to play.  The solution must stream the video file from a remote server (NOT A FLASH MEDIA SERVER).  Are there any settings that need to be adjusted within Flash Professional CS5.5?  Remember, I DO NOT want a Flash Builder solution only Flash Professional CS5.5!

                                • 13. Re: StageVideo on iOS
                                  Sharpie-clemson UGM-MVPs

                                  Did anyone ever come up with a StageVideo example for Flash CS 5.5?

                                   

                                   

                                  Dave

                                  • 14. Re: StageVideo on iOS
                                    billo Community Member

                                    Below is the Flash CS5.5 solution. Make sure your using AIR 3.1 and the AIR for iOS rendering setting is set to GPU.

                                     

                                    package {

                                     

                                              import flash.desktop.NativeApplication;

                                              import flash.desktop.SystemIdleMode;

                                              import flash.display.MovieClip;

                                              import flash.geom.Rectangle;

                                              import flash.media.StageVideo;

                                              import flash.net.NetConnection;

                                              import flash.net.NetStream;

                                     

                                              public class Main extends MovieClip {

                                     

                                                        private var VIDEO_URL:String = "http://www.website.com/video.mp4";

                                     

                                                        private var netConnection:NetConnection;

                                                        private var netStream:NetStream;

                                                        private var video:StageVideo;

                                     

                                                        public function Main() {

                                                                  NativeApplication.nativeApplication.systemIdleMode = SystemIdleMode.KEEP_AWAKE;

                                     

                                                                  netConnection = new NetConnection();

                                                                  netConnection.connect(null);

                                     

                                                                  netStream = new NetStream(netConnection);

                                                                  netStream.client = this;

                                     

                                                                  video = stage.stageVideos[0];

                                                                  video.attachNetStream(netStream);

                                                                  video.viewPort = new Rectangle(0, 0, 480, 270);

                                     

                                                                  netStream.play(VIDEO_URL);

                                                        }

                                     

                                                        public function onMetaData(dataObj:Object):void {

                                                                  // Do nothing.

                                                        }

                                              }

                                    }

                                    • 15. Re: StageVideo on iOS
                                      franky303at Community Member

                                      for me it only plays sound, no video visible

                                      • 16. Re: StageVideo on iOS
                                        billo Community Member

                                        franky303at -- What version of Air are you using?  I used Air 3.1 for this file.  Did you set rendering to GPU?  Did you test it on the device?

                                        • 17. Re: StageVideo on iOS
                                          franky303at Community Member

                                          Tried setting both renderMode "direct" and "gpu". - Using AIR 3.2 SDK ...   And yes, only testing on ipad 2 with iOS 5.1.  Both target ipa-debug and ipa-ad-hoc ...   Video is mp4 with h264 codec.

                                          • 18. Re: StageVideo on iOS
                                            DanaBrousseau Community Member

                                            The tutorial posted here: http://01am.co.uk/comment/2 is working perfectly for me.

                                             

                                            However, I get no audio. The mp4 file itself contains audio (when played in Quicktime) but is silent when played in my IOS app.

                                             

                                            Is there something I need to do to activate StageVideo's sound? Has anyone else had similar issues?

                                            • 19. Re: StageVideo on iOS
                                              M0N5TERS Community Member

                                              I had the same issue. It seems to be a bug. There's an easy way to fix it. Just play a sound, before playing the video.

                                               

                                              I just added a short sound file that I'm playing onLoad. Without this, Flash doesn't seem to know how to handle sound in video files, but once you played a sound, it "remembers" how to do it for stagevideo.

                                               

                                              Silly solution, but it worked for me