Hi,
i am developing a service with red5 and AS3, the problem starts when i try to invoke a client side function from “connect” method, and it actually call the function before triggering the NET_STATUS event, which creates a problem with my current scenario in which i am publishing live video stream, now when i connect to Red5 i get this runtime error…
///////////////////////////////// AS3 Error ///////////////////////////////////////////////////
ArgumentError: Error #2126: NetConnection object must be connected.
at flash.net::NetStream/construct()
at flash.net::NetStream()
at ChatApp/sendStream()
at ChatApp/onUserID()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at com.connections::NetConnectionClient/setUserID()
#onConnectionStatusEvent# NetConnection.Connect.Success
///////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////// Red5 Code //////////////////////////////////////////
@Override
public boolean connect(IConnection conn, IScope scope, Object[] params) {
// Check if the user passed valid parameters.
// if (params == null || params.length == 0) {
// // NOTE: “rejectClient” terminates the execution of the current method!
// rejectClient(“No username passed.”);
// }
// Call original method of parent class.
if (!super.connect(conn, scope, params)) {
return false;
}
//String username = params[0].toString();
String uid = conn.getClient().getId();
Client client = new Client();
client.setUsername("user"+uid);
client.setAge(100);
client.setUid(uid);
System.out.println(client.getUsername() + " : " + uid);
// Register the user in the shared object.
clientMgr.addClient(scope, client);
return true;
}
@Override
public boolean roomConnect(IConnection conn, Object[] user)
{
super.roomConnect(conn, null);
// Notify client about unique id.
ServiceUtils.invokeOnConnection(conn, "setUserID",
new Object[] { uid });
System.out.println("service invoked.....!");
return true;
}
////////////////////////////////////////////////////////////////////////////////////////
can any one tell me how to call the function from client when the red5 application when it has already triggered NET_STATUS event.
Regards