Not able to get stream name

Hi,

I have just started writing wowza server side modules. I have a simple question.

I hit the server using rtmp url with server rtmp://localhost/vod and stream as mp4:sample.mp4

In the module, I want to know how do I print the name of the file requested? I get control inside the function OnConnect when I click on play on the client side. Here I want to do the following:

System.out.println("File requested = "+client.getStreamName()); 

Expected output : File requested = sample.mp4

However I dont see function named getStreamName in IClient class. Its in RTPSession class but my program control doesn’t come within OnRTPSessionCreate function

Please let me know.

Rgds

Nitin

Hi,

System.out.println("File requested = "+client.getStreamName()); 

Nitin

use

List<IMediaStream> Names = client.getPlayStreams();
String StreamNames = ""';
if ( Names.size() >0 )
		{
		Iterator<IMediaStream> iter = Names.iterator();
		while(iter.hasNext())
			{
			IMediaStream stream = (IMediaStream)iter.next();
			StreamNames+=stream.getName();
			}
		}
System.out.println("File requested = "+StreamNames); 

Shamrock

onConnect is too soon to know the name of a stream that client will publish. You can override play or use IMediaStreamActionNotify3.onPlay(), which will happen server-side after the RTMP client does NetStream.publish()

https://www.wowza.com/docs/how-to-override-play-to-control-access

https://www.wowza.com/docs/how-to-use-imediastreamactionnotify3-interface-to-listen-for-rtmp-stream-events-includes-codec-info

Richard

public void onConnect(IClient client, RequestFunction function, AMFDataList params)

{

String userName = getParamString(params, PARAM1);

String password = getParamString(params, PARAM2);

String urunId = getParamString(params, PARAM3);

List Names = client.getPlayStreams();

String StreamNames = “”;

if ( Names.size() >0 )

{

Iterator iter = Names.iterator();

while(iter.hasNext())

{

IMediaStream stream = (IMediaStream)iter.next();

StreamNames+=stream.getName();

}

}

getLogger().error("File requested = "+StreamNames);

and

use

List<IMediaStream> Names = client.getPlayStreams();
String StreamNames = ""';
if ( Names.size() >0 )
		{
		Iterator<IMediaStream> iter = Names.iterator();
		while(iter.hasNext())
			{
			IMediaStream stream = (IMediaStream)iter.next();
			StreamNames+=stream.getName();
			}
		}
System.out.println("File requested = "+StreamNames); 

Shamrock