# how to get wowza stream play status

**URL:** <https://community.wowza.com/t/how-to-get-wowza-stream-play-status/34674>\
**Category:** Wowza Streaming Engine\
**Created:** [April 27, 2010, 9:23am UTC](https://community.wowza.com/t/how-to-get-wowza-stream-play-status/34674 "2010-04-27T09:23:56Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![ricky\_ding](https://avatars.discourse-cdn.com/v4/letter/r/ecd19e/32.png) [@ricky\_ding](https://community.wowza.com/u/ricky_ding)\
**Post date:** [April 27, 2010, 9:23am UTC](https://community.wowza.com/t/how-to-get-wowza-stream-play-status/34674/1 "2010-04-27T09:23:56Z")

</div>

We have 10+ mpeg4 ipcam , using vlc transcoding stream to wowza and played with iphone and flash player.

For transcoding spend much cpu and resources , transcoding server are always in high cpu status even there is no playing request.

For we do not know whether the playing request for one ipcam is stopped, we do not know when one vlc transcoding process should be killed .

So my question : Is there any api so I can get a stream play status , such as playing ,stopped

---

<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:** [April 27, 2010, 6:01pm UTC](https://community.wowza.com/t/how-to-get-wowza-stream-play-status/34674/2 "2010-04-27T18:01:54Z")

</div>

Take a look at these posts:

[Get connection counts to server, application, appInstance and stream](http://community.wowza.com/t/-/43)

[HTTProvider that returns server, vhost, application, appInstance, stream conn. counts](http://community.wowza.com/t/-/84)

Richard

---

<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:** [May 8, 2010, 1:56pm UTC](https://community.wowza.com/t/how-to-get-wowza-stream-play-status/34674/3 "2010-05-08T13:56:05Z")

</div>

Use the IMediaStreamActionNotify interface, the onStop event.

[http://community.wowza.com/t/-/242](http://community.wowza.com/t/-/242)

The easiest notification would be to a Flash application, but you can post to HTTP also with HTTPUtils API

Richard

---

<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:** [May 8, 2010, 8:19pm UTC](https://community.wowza.com/t/how-to-get-wowza-stream-play-status/34674/4 "2010-05-08T20:19:15Z")

</div>

One missing step and one small error:

Missing step: Also create this emtpy folder:

[install-dir]/applications/starvstreamactionnotify

Small error: Add the Classname after the package path:

```auto
<Module>
    <Name>ModuleMediaStreamActionNotify2</Name>
    <Description>ModuleMediaStreamActionNotify2</Description>
 [B] <Class>com.mycompany.wms.streamactionnotify.ModuleMediaStreamActionNotify2</Class>[/B]
</Module>

```

Richard

---

<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:** [May 9, 2010, 2:59pm UTC](https://community.wowza.com/t/how-to-get-wowza-stream-play-status/34674/5 "2010-05-09T14:59:31Z")

</div>

Do you see a line like this in the IDE console?:

> INFO application app-start _definst_ starvstreamactionnotify/_definst_

If not, do something to start this application, e.g. connect to Wowza with rtmp url:

```auto
rtmp://localhost:1935/starvstreamactionnotify

```

Richard

---

<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:** [May 17, 2010, 11:33am UTC](https://community.wowza.com/t/how-to-get-wowza-stream-play-status/34674/6 "2010-05-17T11:33:28Z")

</div>

Great! Glad it’s working, Thank you, and thanks for the update.

Richard

---

<div class="post-metadata">

**Author:** ![Xiaoqing\_Li](https://avatars.discourse-cdn.com/v4/letter/x/7c8e57/32.png) [@Xiaoqing\_Li](https://community.wowza.com/u/Xiaoqing_Li)\
**Post date:** [May 8, 2010, 9:45pm UTC](https://community.wowza.com/t/how-to-get-wowza-stream-play-status/34674/7 "2010-05-08T21:45:47Z")

</div>

Can I obtain a notice from wowza when a client player’s request is stoped.

For example, When a client player stoped watching a stream, can wowza submit a http post request to my PHP application? Or other more efficient way.

---

<div class="post-metadata">

**Author:** ![Xiaoqing\_Li](https://avatars.discourse-cdn.com/v4/letter/x/7c8e57/32.png) [@Xiaoqing\_Li](https://community.wowza.com/u/Xiaoqing_Li)\
**Post date:** [May 9, 2010, 3:25am UTC](https://community.wowza.com/t/how-to-get-wowza-stream-play-status/34674/8 "2010-05-09T03:25:28Z")

</div>

Thanks for the quick reply rrlanham.

I’ve tried like this:

1. Start Wowza IDE 2, File-\>New-\>Wowza Media Server Project.

Project name: starvstreamactionnotify

Package: com.mycompany.wms.streamactionnotify

Name: ModuleMediaStreamActionNotify2

1. Past following code into the “ModuleMediaStreamActionNotify2.java” tab window.

```auto
package com.mycompany.wms.streamactionnotify;

import com.wowza.wms.amf.AMFPacket;
import com.wowza.wms.application.WMSProperties;
import com.wowza.wms.logging.WMSLoggerFactory;
import com.wowza.wms.module.*;
import com.wowza.wms.stream.IMediaStream;
import com.wowza.wms.stream.IMediaStreamActionNotify2;

public class ModuleMediaStreamActionNotify2 extends ModuleBase {
	public void onStreamCreate(IMediaStream stream) {
		getLogger().info("onStreamCreate by: " + stream.getClientId());
		IMediaStreamActionNotify2 actionNotify = new StreamListener();
		
		WMSProperties props = stream.getProperties();
		synchronized(props)
		{
			props.put("streamActionNotifier", actionNotify);
		}
		stream.addClientListener(actionNotify);
	}
	public void onStreamDestroy(IMediaStream stream) {
		getLogger().info("onStreamDestroy by: " + stream.getClientId());
		
		IMediaStreamActionNotify2 actionNotify = null;
		WMSProperties props = stream.getProperties();
		synchronized(props)
		{
			actionNotify = (IMediaStreamActionNotify2)stream.getProperties().get("streamActionNotifier");
		}
		if (actionNotify != null)
		{
			stream.removeClientListener(actionNotify);
			getLogger().info("removeClientListener: "+stream.getSrc());
		}
	}
	
	class StreamListener implements IMediaStreamActionNotify2 
	{
		public void onPlay(IMediaStream stream, String streamName, double playStart, double playLen, int playReset) 
		{
			streamName = stream.getName();
			getLogger().info("Stream Name: " + streamName);
		}
		
		public void onMetaData(IMediaStream stream, AMFPacket metaDataPacket) 
		{
			getLogger().info("onMetaData By: " + stream.getClientId());
		}
		
		public void onPauseRaw(IMediaStream stream, boolean isPause, double location) 
		{
			getLogger().info("onPauseRaw By: " + stream.getClientId());
		}

		public void onSeek(IMediaStream stream, double location)
		{
			getLogger().info("onSeek");
		}
		
		public void onStop(IMediaStream stream)
		{
			getLogger().info("onStop By: " + stream.getClientId());
		}
		
		public void onUnPublish(IMediaStream stream, String streamName, boolean isRecord, boolean isAppend)
		{
			getLogger().info("onUNPublish");
		}

		public void onPublish(IMediaStream stream, String streamName, boolean isRecord, boolean isAppend)
		{
			getLogger().info("onPublish");
		}
		public void onPause(IMediaStream stream, boolean isPause, double location)
		{
			getLogger().info("onPause");
		}
	}
}

```

1. Ctrl+S, then the IDE create a file named ‘starvstreamactionnotify.jar’ into ‘[install-dir]/lib/’.

2. create folder ‘[install-dir]/conf/starvstreamactionnotify’, and copy 'Application.xml under ‘[install-dir]/conf’ into the new folder.

3. Add this module entry as the last entry in the list in my new copied Application.xml file:

```auto
<Module>
    <Name>ModuleMediaStreamActionNotify2</Name>
    <Description>ModuleMediaStreamActionNotify2</Description>
    <Class>com.mycompany.wms.streamactionnotify</Class>
</Module>

```

After these, I restart Wowza Media Server 2, and watching a media stream for serveral minutes. I can see the log infomation by Wowza self outputed on the Wowza Media Server 2 window such as:

…

INFO stream create - -

…

…

INFO stream play vlc.sdp -

…

…

INFO stream stop vlc.sdp -

INFO stream destroy vlc.sdp -

…

But I can’t find any infomation that should be display such as ‘onStreamCreate by:’ defined in onStreamCreate funciton or ‘onStop by:’ defined in onStop function.

**Any step error? please help me**

---

<div class="post-metadata">

**Author:** ![Xiaoqing\_Li](https://avatars.discourse-cdn.com/v4/letter/x/7c8e57/32.png) [@Xiaoqing\_Li](https://community.wowza.com/u/Xiaoqing_Li)\
**Post date:** [May 9, 2010, 1:34pm UTC](https://community.wowza.com/t/how-to-get-wowza-stream-play-status/34674/9 "2010-05-09T13:34:39Z")

</div>

Thanks.

I fixed as you said, but The module seems still not working, I can’t see the output information.

I’ll try it again. or another way to know whether the module is working.

Any hint will be appreciated.

---

<div class="post-metadata">

**Author:** ![Xiaoqing\_Li](https://avatars.discourse-cdn.com/v4/letter/x/7c8e57/32.png) [@Xiaoqing\_Li](https://community.wowza.com/u/Xiaoqing_Li)\
**Post date:** [May 17, 2010, 3:35am UTC](https://community.wowza.com/t/how-to-get-wowza-stream-play-status/34674/10 "2010-05-17T03:35:01Z")

</div>

you are great! rrlanham.

Later I get it worked by your suggestion. thank you for your help!🙂
