Weird - had someone else try this and it works for a video _file_ but I still can't get it to work with limelight...

On Jul 22, 2008, at 10:31 AM, grimmwerks wrote:


I'm trying to connect to an FMS video stream -- but having no luck. I'm popping Alerts on all the NetStatusHandlers - and I not only get Connection.Success but I also get NetStream.Play.Start as the final alert - but no video is appearing on stage. Also even though I'm making a new Object for the nsClient things aren't being alerted on the on_msMeta stuff --

Can someone PLEASE point out what I'm doing wrong, or show me code that works? Appreciated.


---------- Current Code below  ---



<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; layout="absolute" creationComplete="init()">
        
        <mx:Script>
                <![CDATA[
                import mx.utils.ObjectUtil;
                import flash.display.Sprite;
            import flash.events.NetStatusEvent;
            import flash.events.SecurityErrorEvent;
            import flash.media.Video;
            import flash.net.NetConnection;
            import flash.net.NetStream;
            import flash.events.Event;
            import mx.controls.Alert;
                
        private var connection:NetConnection;
        private var stream:NetStream;
private var streamLink:String = "rtmp://scribestud.fc.llnwd.net/ scribestud/_definst_";
                private var linkName:String = "live";
                private var video:Video = new Video();

                

        public function init():void {
NetConnection.defaultObjectEncoding = flash.net.ObjectEncoding.AMF0;
            connection = new NetConnection();
connection.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler); connection.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
            connection.connect(streamLink);
        }

        private function netStatusHandler(event:NetStatusEvent):void {
                 Alert.show(event.info.code);
            switch (event.info.code) {
                case "NetConnection.Connect.Success":
                    connectStream();
                    break;
                case "NetStream.Play.StreamNotFound":
                    Alert.show("Stream not found: " + linkName);
                    break;
            }
        }

private function securityErrorHandler(event:SecurityErrorEvent):void {
            trace("securityErrorHandler: " + event);
        }

        private function connectStream():void {
            stream = new NetStream(connection);
stream.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
            var nsClient:Object = {};
            nsClient.onMetaData = ns_onMetaData;
            nsClient.onCuePoint = ns_onCuePoint;

            video.attachNetStream(stream);
            stream.play(linkName);
            stream.client = nsClient;
            //uic.setActualSize(320,240);
            uic.addChild(video);
          //  addChild(video);
        }

        private function ns_onMetaData(item:Object):void{
                Alert.show("got meta");
                video.width = item.width;
                video.height = item.height;
                uic.width = video.width;
                uic.height = video.height;
                Alert.show(video.width + "  : " + video.height);
                
        }
        private function ns_onCuePoint(item:Object):void{
                Alert.show("cue point");
                
        }


                ]]>
        </mx:Script>
        
        
        
        <mx:Panel id="panel" visible="true" width="320" height="240">
        <mx:UIComponent id="uic" width="320" height="240" />
    </mx:Panel>
        
</mx:Application>


Reply via email to