Friday, August 31, 2007

Re: [Red5] how do I move a new client to a room at connection time?

Q: How can I move a client who connects to the main app to a different room?
A: You use the IConnection.connect( IScope scope ) method like this:

public boolean appStart( IScope app )
appScope = app;
public boolean appConnect ( IConnection conn, Object[] params )
if( !appScope.hasChildScope( "myNewRoom" )){
appScope.createChildScope( "myNewRoom" );
conn.connect( appScope.getScope( "myNewRoom" ) );

return super.appConnect( conn, params );

The ApplicationAdapter.connect method seems to do a reconnect to the main app scope instead of the newly myNewRoom scope. Not sure why that happens but this one was tricky for me , so I hope it spares you some gray matter :D

What's with this?
I've been doing Red5 dev for some time now so I'll try to post here these kind of tricky gems in case someone is interested.
Note: if you are an actionscripter and you feel that the above code looks a bit weird you are right!
It's Jaaaavaaaa :O
Bow and step back, bow and steeep baaack...



Post a Comment

<< Home