Wowza Community

Get request parameters in onConnect event

Hi All,

I am using a url (with parameters) to request live rtp streams: rtmp://IP/rtplive/live.sdp?param1=val1&param2=val2.

In the onConnect I can use the client.getUri() to get the basic application part, but I did not find how can I get the rest of the URL.

I did find that if implementing the play method I can use the params.get(PARAM1) to get the information, but I prefer to do it in the onConnect (the parameters are use for authentication and I want to reject the connection in the onConnect).

Thanks in advance for your help,

Hanan.

You can extract params in onConnect too:

Flash:

netconnection.connnect("rtmp://IP/rtplive",val1,val2);

Wowza:

public void onConnect(IClient client, RequestFunction function,
			AMFDataList params) {
String val1 = getParamString(params,PARAM1);
String val2 = getParamString(params,PARAM2);		 
	}

Richard

Actually these parameters are more likely attached to the stream and not the connection. So the only way to intercept them is in the play command. So you need to do something like:

public void play(IClient client, RequestFunction function, AMFDataList params)
{
	IMediaStream stream = getStream(client, function);
	String queryStr = stream.getQueryStr();
	invokePrevious(client, function, params);
}

Charlie

Try this:

client.getQueryStr();

Richard

For JW Player 5.1, try this:

flashvars=“streamer=rtmp://192.168.1.1/vod&file=mp4:test.mp4?key=129841&provider=rtmp”

For JW Player 4.*, try this:

flashvars=“streamer=rtmp://192.168.1.1/vod&file=mp4:test.mp4?key=129841&type=rtmp”

Richard

Hi Richard,

Thanks for the response, but unfortunately it dose not help me.

The way my client works is just providing the full URL and not using netconnection to pass the parameters.

Please advise,

Hanan.

Again thanks, but still not working (it returns an empty string).

Hanan

I tested the latest code but it still returns empty string.

Here’s my flashvar for JW Player

 flashvars="streamer=rtmp://192.168.1.1/vod&file=mp4:test.mp4?key=129841"

getQueryStr returns empty string with the latest flashvar.

I just noticed that this is for WMS 1.7. I’m on WMS 2.0.

However, I noticed that a code from this thread :

http://www.wowza.com/forums/showthread.php?t=6876

is passing querystring to streamName as well, so all is good.

Thanks