Quantcast
Channel: Adobe Community : All Content - AIR Development
Viewing all articles
Browse latest Browse all 2954

StageVideo on iOS

$
0
0

Hi Guys,

 

I really need you help.

 

I am building an iOS app with adobe air 3.8. And testing it on Iphone 5, iOS 7

 

Im playing a mp4 with stageVideo and everything works fine apart from the fact the every second/third time or so that I open the app and plat the video the app crashes without any warning!

 

Please.....Can any one help ?

 

Here is the simple code that I use:

 

Thanx in advance

 

/Henry

 

 

 

import flash.net.NetStream;

import flash.net.NetConnection;

 

         var netStream:NetStream;

         var netConnection:NetConnection;

         var video:Video;

 

 

            netConnection = new NetConnection();

            netConnection.connect(null);

            netStream = new NetStream(netConnection);

            netStream.client = new Object();

 

            video = new Video(320,240);

            video.attachNetStream(netStream); // might be overridden later

 

            // Set up normal display list properties

            video.x = 100;

            video.y = 100;

            video.width = 320;

            video.height = 240;

            addChild(video);

           

            netStream.addEventListener(AsyncErrorEvent.ASYNC_ERROR, asyncErrorHandler);

 

            // Try to render as stage video

            var v:Vector.<StageVideo> = stage.stageVideos;

            if ( v.length >= 1 ) {

                var stageVideo:StageVideo = v[0];

                stageVideo.viewPort =

                    new Rectangle(100,100,320,240);

                stageVideo.addEventListener(

                    StageVideoEvent.RENDER_STATE,renderStateEventHandler);

                stageVideo.attachNetStream(netStream);

            }

 

            netStream.play("filmtest_1.mp4");

 

 

         function renderStateEventHandler(event:StageVideoEvent):void

        {

            // If video is not rendered properly let the

            // video object in the display list try to render it.

            if ( event.status == StageVideoEvent.RENDER_STATUS_UNAVAILABLE ) {

                video.attachNetStream(netStream);

            }

        }

 

 

function asyncErrorHandler(event:AsyncErrorEvent):void {

    trace(event.text);

}      


Viewing all articles
Browse latest Browse all 2954

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>