# Not able to get stream name

**URL:** <https://community.wowza.com/t/not-able-to-get-stream-name/38193>\
**Category:** Wowza Developer Dojo\
**Tags:** wowza-streaming-server-java-api\
**Created:** [February 19, 2012, 1:09am UTC](https://community.wowza.com/t/not-able-to-get-stream-name/38193 "2012-02-19T01:09:24Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nitin\_kaplan](https://avatars.discourse-cdn.com/v4/letter/n/ea5d25/32.png) [@Nitin\_kaplan](https://community.wowza.com/u/Nitin_kaplan)\
**Post date:** [February 19, 2012, 1:09am UTC](https://community.wowza.com/t/not-able-to-get-stream-name/38193/1 "2012-02-19T01:09:24Z")

</div>

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:

```auto
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

---

<div class="post-metadata">

**Author:** ![Andrew\_Kennedy](https://avatars.discourse-cdn.com/v4/letter/a/ecb155/32.png) [@Andrew\_Kennedy](https://community.wowza.com/u/Andrew_Kennedy)\
**Post date:** [February 19, 2012, 1:11am UTC](https://community.wowza.com/t/not-able-to-get-stream-name/38193/2 "2012-02-19T01:11:54Z")

</div>

> Hi,
> 
> ```auto
> System.out.println("File requested = "+client.getStreamName()); 
> 
> ```
> 
> Nitin

use

```auto
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

---

<div class="post-metadata">

**Author:** ![Richard\_Lanham](https://avatars.discourse-cdn.com/v4/letter/r/c68b51/32.png) [@Richard\_Lanham](https://community.wowza.com/u/Richard_Lanham)\
**Post date:** [September 25, 2012, 1:47pm UTC](https://community.wowza.com/t/not-able-to-get-stream-name/38193/3 "2012-09-25T13:47:17Z")

</div>

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-override-play-to-control-access)

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

Richard

---

<div class="post-metadata">

**Author:** ![Serhan\_VARHAN](https://avatars.discourse-cdn.com/v4/letter/s/97f17d/32.png) [@Serhan\_VARHAN](https://community.wowza.com/u/Serhan_VARHAN)\
**Post date:** [September 23, 2012, 6:57pm UTC](https://community.wowza.com/t/not-able-to-get-stream-name/38193/4 "2012-09-23T18:57:31Z")

</div>

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
> 
> ```auto
> 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
