I am trying to connect to an RTMP stream from the Flash Media server
in Flex 2. I have yet to be able to pull this off. Following the api I
have the following class in the components directory and below that
the mxml. This is the error that I receive. Any ideas on how to make
this work would be greatly appreciated. 

Video Example!
netStatusHandler
connectStream
netStatusHandler
Unable to locate video: rtmp://10.3.0.104/iscam1



-- Wade

 package components {
    import flash.display.Sprite;
    import flash.events.*;
    import flash.media.Video;
    import flash.net.NetConnection;
    import flash.net.NetStream;

    public class VideoExample extends Sprite {
        private var videoURL:String = "rtmp://10.3.0.104/iscam1";
        private var connection:NetConnection;
        private var stream:NetStream;

        public function VideoExample() {
                trace("Video Example!");
            connection = new NetConnection();
            connection.addEventListener(NetStatusEvent.NET_STATUS,
netStatusHandler);
           
connection.addEventListener(SecurityErrorEvent.SECURITY_ERROR,
securityErrorHandler);
            connection.connect(null);
        }

        private function netStatusHandler(event:NetStatusEvent):void {
                trace("netStatusHandler");
            switch (event.info.code) {
                case "NetConnection.Connect.Success":
                    connectStream();
                    break;
                case "NetStream.Play.StreamNotFound":
                    trace("Unable to locate video: " + videoURL);
                    break;
            }
        }

        private function connectStream():void {
                trace("connectStream");
            var stream:NetStream = new NetStream(connection);
            stream.addEventListener(NetStatusEvent.NET_STATUS,
netStatusHandler);
            stream.addEventListener(AsyncErrorEvent.ASYNC_ERROR,
asyncErrorHandler);
            var video:Video = new Video();
            video.attachNetStream(stream);
            stream.play(videoURL);
            addChild(video);
        }

        private function
securityErrorHandler(event:SecurityErrorEvent):void {
            trace("securityErrorHandler: " + event);
        }
        
        private function asyncErrorHandler(event:AsyncErrorEvent):void {
            // ignore AsyncErrorEvent events.
        }
    }
 }



AND THE MXML

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
xmlns:T8="components.*"
layout="vertical" horizontalAlign="left">

<T8:VideoExample />

</mx:Application>







--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/flexcoders/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[EMAIL PROTECTED] 
    mailto:[EMAIL PROTECTED]

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to