Get client stream name on disconnect

You can get the client stream name onDisconnect (rtmp connections) by adding it to the property of the IClient object.  Try the following:

public void play(IClient client, RequestFunction function, AMFDataList params) {

IMediaStream stream = getStream(client, function);
String streamName = getParamString(params, PARAM1);
client.getProperties().setProperty("MYSTREAMNAME", streamName);
invokePrevious(this, client, function, params);
}

public void onDisconnect(IClient client) {

System.out.println("Stream requested::"+client.getProperties().getPropertyStr("MYSTREAMNAME"));
}

The reason to do this is that onDisconnect the stream information no longer exists. This (the above code) will allow you to store the info within the IClient object for reference onDisconnect.


Comments are closed.