Sorry, Forget my previous post..that will not work...here goes the right
one. This should work!!!!
Channel channel = conn.getChannel((byte) 3);
Map<String, Object> params = new HashMap<String, Object>();
params.put("app", "hibernate/edu");
params.put("flashVer", "WIN 9,0,16,0");
params.put("swfUrl", "http://localhost/test.swf");
params.put("tcUrl", "rtmp://localhost/hibernate/er");
params.put("fpad", false);
params.put("audioCodecs", (double) 615);
params.put("videoCodecs", (double) 76);
params.put("pageUrl", "http://localhost/test.html");
params.put("objectEncoding", (double) 0);
Map<String, Object> tparams = new HashMap<String, Object>();
tparams.put("password", "22");
tparams.put("username", "22");
Object[] obj = new Object[] { tparams };
PendingCall pendingCall = new PendingCall("connect", obj);
Invoke invoke = new Invoke(pendingCall);
invoke.setConnectionParams(params);
invoke.setInvokeId(1);
channel.write(invoke);
> Have you folks tried using OpenAmf instead? It worked perfectly fine
> for me and I experienced no (de)serialization issues:
>
> dwnld & tutorial:
> http://www.flash-db.com/Tutorials/helloOpenamf/index.php
>
>
> */Guillaume Lecanu <[EMAIL PROTECTED]>/* wrote:
>
> Hi,
>
> I have exactly the same problem.
> Parameters sent from RTMPClient can't be readed from the
> appConnect() of Red5.
>
> Sri Kalyanaraman seems to say it's a problem of AMF encoding, may
> be there is methods we can uses to encode the params object in AMF
> before to uses it in the RTMPClient.connect() ?
>
> Thanks for your help.
>
> Le jeudi 15 février 2007 à 12:36 +0200, Sri Kalyanaraman a écrit :
>> Hi guys,
>>
>> I have an application where client should pass username and
>> password as the connection parameters. If the parameters are
>> invalid, I will close the connection to the user.
>>
>> public boolean roomConnect(IConnection conn, Object[] params)
>> {
>> log.debug("New connection attempt from " +
>> conn.getRemoteAddress() + "...params.." + params.length + "::" +
>> conn.hashCode());
>>
>> // Parse the user/pass out of the connection parameters
>> HashMap map = (HashMap) params[0];
>> String userName = (String) map.get("username");
>> String password = (String) map.get("password");
>> if(!(userName.equals("test") &&
>> password.equals("pass"))) return false;
>> else return true;
>> }
>> Now, I wish to create a Java client to test this code. I tried my
>> best, but atlast found that, I need to pass the connection
>> parameters in the amf/amf3 format. This is the reason why the
>> flex client passes here and the RTMPClient() fails here. Below is
>> my RTMPClient (Java client) code.
>>
>> ObjectMap<String, Object> params = new ObjectMap();
>> params.put("objectEncoding",(int)3);
>> params.put("app","hibernate/r4i");
>> params.put("fpad", false);
>> params.put("flashVer", "WIN 9,0,28,0");
>> params.put("tcUrl", "rtmp://localhost/oflaDemo");
>> params.put("audioCodecs",(double)615);
>> params.put("videoFunction",(double)1);
>> params.put("pageUrl","http://localhost/test.html"
>> <http://localhost/test.html>);
>> params.put("swfUrl","http://localhost/test.swf"
>> <http://localhost/test.swf>);
>> params.put("videoCodecs",(double)124);
>>
>> params.put("password","pass");
>> params.put("username","test");
>>
>> client.connect("127.0.0.1",1935,params);
>>
>> I tried passing the Object[] as arguments as below..*Still fails
>> from Java client*.
>>
>> ObjectMap<String, Object> tparams = new
>> ObjectMap<String, Object>();
>> tparams.put("password","pass");
>> tparams.put("username","test");
>> Object[] obj = new Object[]{params,tparams};
>> client.connect("127.0.0.1",1935,obj);
>>
>>
>> The reason I found is,
>>
>> *org.red5.server.net.rtmp.codec.RTMPProtocolDecoder *has this method
>>
>> *protected Notify decodeNotifyOrInvoke(Notify notify, ByteBuffer
>> in, Header header, RTMP rtmp) {}*
>>
>> which expects a bytebuffer in amf format. It deserializes the
>> org.red5.io.amf.Input object according to the amf format as
>> intended. Is ther any other way to have a proper amf client for
>> red5 in Java?
>>
>> *Objective : *That would definitely help in testing the code/for
>> those who don't know actionscript 3.0/for those who don't have
>> flex licenses :).
>>
>> Thanks,
>> Sri.
>> _______________________________________________ Red5 mailing list
>> [email protected] <mailto:[email protected]>
>> http://osflash.org/mailman/listinfo/red5_osflash.org
> _______________________________________________
> Red5 mailing list
> [email protected]
> http://osflash.org/mailman/listinfo/red5_osflash.org
>
>
> ------------------------------------------------------------------------
> Don't get soaked. Take a quick peek at the forecast
> <http://tools.search.yahoo.com/shortcuts/?fr=oni_on_mail&#news>
> with theYahoo! Search weather shortcut.
> <http://tools.search.yahoo.com/shortcuts/?fr=oni_on_mail&#news>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Red5 mailing list
> [email protected]
> http://osflash.org/mailman/listinfo/red5_osflash.org
>
_______________________________________________
Red5 mailing list
[email protected]
http://osflash.org/mailman/listinfo/red5_osflash.org