[flexcoders] Re: NetConnection.Connect.Failed
Does anyone can help me ??? Thanks --- In flexcoders@yahoogroups.com, arokyzxc [EMAIL PROTECTED] wrote: I've tried this nc = new NetConnection(); nc.connect(rtmp:/videodisplay); nc.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler); nc.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler); and i got NetConnection.Connect.Failed message. I checked that fms was running ,also saw videodisplay _definst_ was loaded from server admin panel. i was really confused about it , any suggestion would be appreciate .
[flexcoders] Re: NetConnection.Connect.Failed
hello greg h Sorry to bother you again . I met the problem that I couldn't play flv file streaming from FMS server in browser. here is my codes: var nc:NetConnection ; public function connection():void{ if (Connect_btn.label == Connect ){ nc = new NetConnection(); nc.objectEncoding = flash.net.ObjectEncoding.AMF0; nc.addEventListener(NetStatusEvent.NET_STATUS, ncStatusHandler); nc.connect(rtmp:/videodisplay); Connect_btn.label = DisConnection; }else{ nc.close(); } } private function ncStatusHandler(event:NetStatusEvent):void{ var status :String = event.info.code; switch (status) { case NetConnection.Connect.Success: connectStream(); break; } } private function netStatusHandler(event:NetStatusEvent):void { var status :String = event.info.code; switch (status) { case NetStream.Play.StreamNotFound: result.text = Stream not found: ; break; case NetStream.Play.Reset: result.text = play reset ; break ; case NetStream.Play.Start: result.text = playing; break; } } private function connectStream():void { var stream:NetStream = new NetStream(nc); stream.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler); var client:Object = new Object( ); client.onMetaData = function(metadata:Object):void { trace(metadata.duration); }; stream.client = client; stream.play(phone.flv); var video:Video = new Video(); video.height = 120; video.width = 200; video.attachNetStream(stream); canvas.addChild(video); } I placed phone.flv file in applications/videodisplay directory .When I debug this application , these codes caught all cases decleared in ncStatusHandler and netStatusHandler function .However , the surprisingthing is phone.flv couldn't be played .I saw phone.flv was loaded in View application tab of admin panel ,and type ,status of phone.flv was respectively Live ,Viewing.I totally confused where was wrong ? Thanks in advance.
RE: [flexcoders] Re: NetConnection.Connect.Failed
Can you give me the URL to that specific FMS example? That nc.connect URL looks a little odd. Is your server name really tutorial_hello, or did you just remove this information for the purposes of posting to this forum? Typically, I'd expect an RTMP URL to look more like this: rtmp://myserver:1935/myapplicaton/myroom From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of arokyzxc Sent: Wednesday, April 25, 2007 3:53 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: NetConnection.Connect.Failed I download fms example from adobe site, it works fine that sucessfully connected FMS server.but it didn't work that i wrote my codes followed exmaple tutorial, it always reports connect failed .I can see connects number was increased when i run my app in admin console. I wrote codes in Flex Builder, named HelloFms.mxml.But i wondering whether i should write fla file,instead of mxml file ? The error (NetConnection.Connect.Failed) does matter with this ?? how can i establish my work environment ??? here is my client-side codes: helloFms.mxml ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml http://www.adobe.com/2006/mxml layout=absolute mx:Script ![CDATA[ import flash.events.NetStatusEvent; import flash.events.SecurityErrorEvent; import flash.net.NetConnection; import flash.net.NetStream; import flash.events.Event; var nc :NetConnection; public function connection():void{ if (Connect_btn.label == Connect ){ nc.connect(rtmp:/tutorial_hello/room_01,test); nc.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler); nc.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler); }else{ nc.close(); } } private function netStatusHandler(event:NetStatusEvent):void { var status :String = event.info.code; switch (status) { case NetConnection.Connect.Success: /* connectStream(); */ break; case NetStream.Play.StreamNotFound: result.text = Stream not found; break; } } private function securityErrorHandler(event:SecurityErrorEvent):void { result.text = securityErrorHandler: + event; } ]] /mx:Script mx:Button x=331 y=91 label=Connect id=Connect_btn click=connection()/ mx:TextArea x=118 y=164 id=result/ /mx:Application here is server-side codes: main.asc application.onConnect = function(p_client,text) { application.acceptConnection(p_client); //text handler } Any help would be appreciate .
[flexcoders] Re: NetConnection.Connect.Failed
ye ,the typically or normally RTMP URL would looks more like this : rtmp://myserver:1935/myapplicaton/myappinstance , for the specific localhost server would be like this: rtmp://localhost:1935/myapplication/myappinstance, but it can also written : rtmp:/myapplication/myappinstance , because the format of RTMP URL was rtmp:[//server][:port]/application[/instance]. This problem really gave me headache for a few days ,why my application can not talk to FMS server ,but example downloaded form adobe site can .My application was very like example ,except some little personal custom . Can somebody help me ??? Thanks a lot . --- In flexcoders@yahoogroups.com, Peter Farland [EMAIL PROTECTED] wrote: Can you give me the URL to that specific FMS example? That nc.connect URL looks a little odd. Is your server name really tutorial_hello, or did you just remove this information for the purposes of posting to this forum? Typically, I'd expect an RTMP URL to look more like this: rtmp://myserver:1935/myapplicaton/myroom From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of arokyzxc Sent: Wednesday, April 25, 2007 3:53 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: NetConnection.Connect.Failed I download fms example from adobe site, it works fine that sucessfully connected FMS server.but it didn't work that i wrote my codes followed exmaple tutorial, it always reports connect failed .I can see connects number was increased when i run my app in admin console. I wrote codes in Flex Builder, named HelloFms.mxml.But i wondering whether i should write fla file,instead of mxml file ? The error (NetConnection.Connect.Failed) does matter with this ?? how can i establish my work environment ??? here is my client-side codes: helloFms.mxml ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml http://www.adobe.com/2006/mxml layout=absolute mx:Script ![CDATA[ import flash.events.NetStatusEvent; import flash.events.SecurityErrorEvent; import flash.net.NetConnection; import flash.net.NetStream; import flash.events.Event; var nc :NetConnection; public function connection():void{ if (Connect_btn.label == Connect ){ nc.connect(rtmp:/tutorial_hello/room_01,test); nc.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler); nc.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler); }else{ nc.close(); } } private function netStatusHandler(event:NetStatusEvent):void { var status :String = event.info.code; switch (status) { case NetConnection.Connect.Success: /* connectStream(); */ break; case NetStream.Play.StreamNotFound: result.text = Stream not found; break; } } private function securityErrorHandler(event:SecurityErrorEvent):void { result.text = securityErrorHandler: + event; } ]] /mx:Script mx:Button x=331 y=91 label=Connect id=Connect_btn click=connection()/ mx:TextArea x=118 y=164 id=result/ /mx:Application here is server-side codes: main.asc application.onConnect = function(p_client,text) { application.acceptConnection(p_client); //text handler } Any help would be appreciate .
Re: [flexcoders] Re: NetConnection.Connect.Failed
arokyzxc, Following at at the end is an excerpt from an article by Renaun regarding Flex FMS. The excerpt covers how to set in Flex/AS3 the correct NetConnection.objectEncoding when communicating with FMS 2. Full article is here: http://mxdj.sys-con.com/read/295379.htm Demo and downloadable source on Renaun's sample app here: http://renaun.com/blog/2006/10/28/139/ Please post back regarding whether this helps you or not. Best regards, g EXCERPT The Flash Player 9 introduced a newer Action Message Format version called AMF3. Flex 2 creates ActionScript 3.0 SWF's, but Flash Media Server is still based on ActionScript 2.0 and the earlier AMF0. By default, the Flex 2 NetConnection class uses AMF3, therefore you must tell the NetConnection what object encoding to use. There are two ways to do this: var nc:NetConnection = new NetConnection(); nc.objectEncoding = flash.net.ObjectEncoding.AMF0; or NetConnection.defaultObjectEncoding = flash.net.ObjectEncoding.AMF0; The first method changes the object encoding for the instantiated object only, whereas the second method changes the object encoding for all NetConnections globally. With the NetConnection set to use AMF0, the Flex application will know how to communicate with the FMS application properly.
[flexcoders] Re: NetConnection.Connect.Failed
greg h It's wonderful , I feel exciting about it . My app can talk to FMS sucessfully, the only thing that result in failing exactly was Action Message Format version .You do me a great favor ,thanks a lot. Best regards arokyzxc --- In flexcoders@yahoogroups.com, greg h [EMAIL PROTECTED] wrote: arokyzxc, Following at at the end is an excerpt from an article by Renaun regarding Flex FMS. The excerpt covers how to set in Flex/AS3 the correct NetConnection.objectEncoding when communicating with FMS 2. Full article is here: http://mxdj.sys-con.com/read/295379.htm Demo and downloadable source on Renaun's sample app here: http://renaun.com/blog/2006/10/28/139/ Please post back regarding whether this helps you or not. Best regards, g EXCERPT The Flash Player 9 introduced a newer Action Message Format version called AMF3. Flex 2 creates ActionScript 3.0 SWF's, but Flash Media Server is still based on ActionScript 2.0 and the earlier AMF0. By default, the Flex 2 NetConnection class uses AMF3, therefore you must tell the NetConnection what object encoding to use. There are two ways to do this: var nc:NetConnection = new NetConnection(); nc.objectEncoding = flash.net.ObjectEncoding.AMF0; or NetConnection.defaultObjectEncoding = flash.net.ObjectEncoding.AMF0; The first method changes the object encoding for the instantiated object only, whereas the second method changes the object encoding for all NetConnections globally. With the NetConnection set to use AMF0, the Flex application will know how to communicate with the FMS application properly.
[flexcoders] Re: NetConnection.Connect.Failed
I download fms example from adobe site, it works fine that sucessfully connected FMS server.but it didn't work that i wrote my codes followed exmaple tutorial, it always reports connect failed .I can see connects number was increased when i run my app in admin console. I wrote codes in Flex Builder, named HelloFms.mxml.But i wondering whether i should write fla file,instead of mxml file ? The error (NetConnection.Connect.Failed) does matter with this ?? how can i establish my work environment ??? here is my client-side codes: helloFms.mxml ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=absolute mx:Script ![CDATA[ import flash.events.NetStatusEvent; import flash.events.SecurityErrorEvent; import flash.net.NetConnection; import flash.net.NetStream; import flash.events.Event; var nc :NetConnection; public function connection():void{ if (Connect_btn.label == Connect ){ nc.connect(rtmp:/tutorial_hello/room_01,test); nc.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler); nc.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler); }else{ nc.close(); } } private function netStatusHandler(event:NetStatusEvent):void { var status :String = event.info.code; switch (status) { case NetConnection.Connect.Success: /* connectStream(); */ break; case NetStream.Play.StreamNotFound: result.text = Stream not found; break; } } private function securityErrorHandler(event:SecurityErrorEvent):void { result.text = securityErrorHandler: + event; } ]] /mx:Script mx:Button x=331 y=91 label=Connect id=Connect_btn click=connection()/ mx:TextArea x=118 y=164 id=result/ /mx:Application here is server-side codes: main.asc application.onConnect = function(p_client,text) { application.acceptConnection(p_client); //text handler } Any help would be appreciate .
[flexcoders] Re: NetConnection.Connect.Failed
any one can help me thanks in advance.