Skip navigation
KarelBrascamp
Currently Being Moderated

StageVideo on iOS

Aug 29, 2011 2:17 AM

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

 
Replies
  • Currently Being Moderated
    Aug 29, 2011 2:45 AM   in reply to KarelBrascamp

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

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 29, 2011 4:49 AM   in reply to KarelBrascamp

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

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 3, 2011 3:30 AM   in reply to KarelBrascamp

    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

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 6, 2011 5:51 AM   in reply to sebelga

    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

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 6, 2011 8:27 AM   in reply to KarelBrascamp

    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

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 19, 2011 12:31 AM   in reply to KarelBrascamp

    @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)

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 20, 2011 1:50 AM   in reply to Arthy the crab

    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) ????

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 7, 2011 6:50 AM   in reply to KarelBrascamp

    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 ) );

                        }

              }

    }

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 11, 2012 6:55 AM   in reply to KarelBrascamp

    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!

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 13, 2012 11:40 AM   in reply to KarelBrascamp

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

     

     

    Dave

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 25, 2012 12:38 PM   in reply to KarelBrascamp

    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.

                        }

              }

    }

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 25, 2012 12:55 PM   in reply to billo

    for me it only plays sound, no video visible

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 26, 2012 4:50 AM   in reply to franky303at

    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?

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 26, 2012 8:08 AM   in reply to billo

    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.

     
    |
    Mark as:
  • Currently Being Moderated
    May 18, 2012 5:52 AM   in reply to KarelBrascamp

    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?

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 21, 2012 5:31 PM   in reply to DanaBrousseau

    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

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points