[Red5devs] onBWDone error while connecting to FMS with a Java client.

Posco, TSO Fung Po posco.tso at gmail.com
Wed Jul 16 23:12:15 PDT 2008


Hi Ryan,

Thank you very much for your prompt reply. I am using a Java Client
(Inheriting RTMPClient) rather than using actionscript. Because I am
writing a proxy that would relay and transcode the received
audio/video to other application. I am facing a difficulty to receive
streamed data from FMS, although this java client works very well with
red5 (build from latest trunk).

Regards,
Posco

On Thu, Jul 17, 2008 at 12:24 PM, Ryan Christensen [drawcode]
<ryan at drawcode.com> wrote:
> Not sure if this is what you are asking but in actionscript code to connect
> to Red5 you do need an OnBWDone method.  Here is a connection class I use:
>
> package drawlogic.as3.net
> {
>         import flash.events.EventDispatcher;
>         import flash.net.NetConnection;
>         import flash.net.ObjectEncoding;
>         import flash.events.NetStatusEvent;
>         import flash.events.SecurityErrorEvent;
>
>         import com.blitzagency.xray.logger.XrayLog;
>
>         import drawlogic.as3.util.OutputPanel;
>
>         import drawlogic.as3.net.Red5Connection;
>         import drawlogic.as3.net.Events.Red5ConnectionEvent;
>
>         public class Red5Connection extends EventDispatcher
>         {
>
>                 private var nc:NetConnection;
>                 private var uri:String;
>                 private var log:XrayLog;
>
>                 public function Red5Connection()
>                 {
>                         // xray if needed
>                         log = new XrayLog();
>
>                         //  create the netConnection
>                         nc = new NetConnection();
>                         //  set it's client/focus to this
>                         nc.client = this;
>
>                         // add listeners for netstatus and security issues
>                         nc.addEventListener(NetStatusEvent.NET_STATUS,
> netStatusHandler);
>
> nc.addEventListener(SecurityErrorEvent.SECURITY_ERROR,
> securityErrorHandler);
>
>
>                         // set the encoding to AMF0 - still waiting for AMF3
> to be implemented on Red5
>                         nc.objectEncoding = ObjectEncoding.AMF0;
>                 }
>
>                 public function connect():void
>                 {
>                         if(getURI().length == 0)
>                         {
>                                 trace("please provide a valid URI connection
> string", "URI Connection String missing");
>                                 return;
>                         }else if(nc.connected)
>                         {
>                                 trace("You are already connected to " +
> getURI(), "Already connected");
>                                 return;
>                         }
>                         nc.connect(getURI());
>                 }
>
>                 public function close():void
>                 {
>                         nc.close();
>                 }
>
>                 public function setURI(p_URI:String):void
>                 {
>                         uri = p_URI;
>                 }
>
>                 public function getURI():String
>                 {
>                         return uri;
>                 }
>
>                 public function getConnection():NetConnection
>                 {
>                         return nc;
>                 }
>
>                 public function getConnected():Boolean
>                 {
>                         return nc.connected;
>                 }
>
>                 public function onBWDone():void
>                 {
>                         // have to have this for an RTMP connection
>                 }
>
>                 private function netStatusHandler(event:NetStatusEvent):void
>                 {
>                         log.debug("netStatus", event.info.code);
>                         var e:Red5ConnectionEvent;
>                         switch(event.info.code)
>                         {
>                                 case "NetConnection.Connect.Failed":
>                                         e = new
> Red5ConnectionEvent(Red5ConnectionEvent.RED5_FAILED, false, false,
> event.info.code);
>                                         dispatchEvent(e);
>                                 break;
>
>                                 case "NetConnection.Connect.Success":
>                                         e = new
> Red5ConnectionEvent(Red5ConnectionEvent.RED5_SUCCESS, false, false,
> event.info.code);
>                                         dispatchEvent(e);
>                                 break;
>
>                                 case "NetConnection.Connect.Rejected":
>                                         e = new
> Red5ConnectionEvent(Red5ConnectionEvent.RED5_REJECTED, false, false,
> event.info.code);
>                                         dispatchEvent(e);
>                                 break;
>
>                                 case "NetConnection.Connect.Closed":
>                                         e = new
> Red5ConnectionEvent(Red5ConnectionEvent.RED5_CLOSED, false, false,
> event.info.code);
>                                         dispatchEvent(e);
>                                 break;
>
>                                 case "NetConnection.Connect.InvalidApp":
>                                         e = new
> Red5ConnectionEvent(Red5ConnectionEvent.RED5_INVALIDAPP, false, false,
> event.info.code);
>                                         dispatchEvent(e);
>                                 break;
>
>                                 case "NetConnection.Connect.AppShutdown":
>                                         e = new
> Red5ConnectionEvent(Red5ConnectionEvent.RED5_APPSHUTDOWN, false, false,
> event.info.code);
>                                         dispatchEvent(e);
>                                 break;
>                         }
>
>                         if(event.info.code !=
> "NetConnection.Connect.Success")
>                         {
>                                 // I dispatch DISCONNECTED incase someone
> just simply wants to know if we're not connected'
>                                 // rather than having to subscribe to the
> events individually
>                                 e = new
> Red5ConnectionEvent(Red5ConnectionEvent.RED5_DISCONNECTED, false, false,
> event.info.code);
>                                 dispatchEvent(e);
>                         }
>                 }
>
>                 private function
> securityErrorHandler(event:SecurityErrorEvent):void
>                 {
>                         log.debug("nc error", event.text);
>                         var e:Red5ConnectionEvent = new
> Red5ConnectionEvent(Red5ConnectionEvent.RED5_SECURITYERROR, false, false,
> event.text);
>                         dispatchEvent(e);
>                 }
>         }
> }
>
>
>
> On Wed, Jul 16, 2008 at 9:15 PM, Posco, TSO Fung Po <posco.tso at gmail.com>
> wrote:
>>
>> Hi There,
>>
>> I am a newbie to red5 and that's why i am seeking for help here : ).
>>
>> I downloaded a java client written by peter from
>>
>> (http://ptrthomas.wordpress.com/2008/04/19/how-to-record-rtmp-flash-video-streams-using-red5/#comment-12974)
>> and run it with red5.jar from
>> (http://rtmprip.jtvlan.org/downloads/rtmprip.jar).
>>
>> when I run this java client to record a sample.flv from a Flash Media
>> Development Server, I got following error:
>> 12:00:31.690 [AnonymousIoService-4] DEBUG
>> o.r.s.n.r.codec.RTMPProtocolEncoder - Writing result: Status code:
>> NetConnection.Call.Failed desc: Method onBWDone without arguments not
>> found level: error
>>
>> I think this is the main error that causes FMS to terminate the
>> connection, how can I solve this type of problem? by overwriting
>> onBWDone?
>>
>> Thanks in advance!!
>> --
>> Yogi Berra  - "A nickel ain't worth a dime anymore."
>>
>> _______________________________________________
>> Red5devs mailing list
>> Red5devs at osflash.org
>> http://osflash.org/mailman/listinfo/red5devs_osflash.org
>
>
>
> --
> --
> Ryan Christensen
> drawk.design and develop < drawk.com | drawcode.com >
> ryan - @ - drawk - dot - com - 480 . 612 . 4957
> < platforms: .net-c#-ironpython | python | flash-flex-air-as3 | ruby/rails |
> silverlight-dlr | es4 | javascript | c/c++ | lua | java | php >
> < content: css | xhtml | jquery-dojo | xml-rpc-atom-rss-rest | standards |
> syndication | blogs | mobile/sms | microformats >
> < datastores: ms sql | oracle | mysql | postgresql | cloud | distributed |
> couchdb >
> [ drawcode.com | drawk.com | drawlogic.com ]
> [ mcsd c#.net | mcsd c++ | mcad.net | java | flash ]
> _______________________________________________
> Red5devs mailing list
> Red5devs at osflash.org
> http://osflash.org/mailman/listinfo/red5devs_osflash.org
>
>



-- 
Yogi Berra  - "A nickel ain't worth a dime anymore."



More information about the Red5devs mailing list