# IMediaStreamActionNotify2 or IModuleOnStream doesn't  detect stream publishin

**URL:** <https://community.wowza.com/t/imediastreamactionnotify2-or-imoduleonstream-doesnt-detect-stream-publishin/40015>\
**Category:** Wowza Developer Dojo\
**Tags:** wowza-streaming-server-java-api\
**Created:** [June 22, 2014, 10:57am UTC](https://community.wowza.com/t/imediastreamactionnotify2-or-imoduleonstream-doesnt-detect-stream-publishin/40015 "2014-06-22T10:57:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Richard\_Perez](https://avatars.discourse-cdn.com/v4/letter/r/48db29/32.png) [@Richard\_Perez](https://community.wowza.com/u/Richard_Perez)\
**Post date:** [June 22, 2014, 10:57am UTC](https://community.wowza.com/t/imediastreamactionnotify2-or-imoduleonstream-doesnt-detect-stream-publishin/40015/1 "2014-06-22T10:57:19Z")

</div>

Hello everybody,

I’m trying to detect in my HTTPProviderBase Module when a stream is publish.

I tried the following implementation :

1. 

```auto
public class VODlist extends HTTProvider2Base implements IModuleOnStream

```

with the function

```auto
public void onStreamCreate(IMediaStream stream) {
		WMSLoggerFactory.getLogger(null).info("DETECT CREATION");
}

```

the function is never fired.

I also tried with the following implementation.

1. 

```auto
public class VODlist extends HTTProvider2Base implements IMediaStreamActionNotify2 

```

with the functions

```auto
@Override
	public void onPlay(IMediaStream stream, String streamName,
			double playStart, double playLen, int playReset) {
		WMSLoggerFactory.getLogger(null).info("DETECT PLAY");
		
	}
	@Override
	public void onPublish(IMediaStream stream, String streamName,
			boolean isRecord, boolean isAppend) {
		WMSLoggerFactory.getLogger(null).info("DETECT PUBLISH");
		
	}
	@Override
	public void onSeek(IMediaStream stream, double location) {
		// TODO Auto-generated method stub
		WMSLoggerFactory.getLogger(null).info("DETECT SEEK");
	}
	@Override
	public void onStop(IMediaStream stream) {
		// TODO Auto-generated method stub
		
	}
	@Override
	public void onUnPublish(IMediaStream stream, String streamName,
			boolean isRecord, boolean isAppend) {
		// TODO Auto-generated method stub
		WMSLoggerFactory.getLogger(null).info("DETECT UNPUBLISH");
		
	}
	@Override
	public void onMetaData(IMediaStream arg0, AMFPacket arg1) {
		// TODO Auto-generated method stub
		WMSLoggerFactory.getLogger(null).info("DETECT METADATA");
	}
	@Override
	public void onPauseRaw(IMediaStream arg0, boolean arg1, double arg2) {
		// TODO Auto-generated method stub
		WMSLoggerFactory.getLogger(null).info("DETECT PAUSE");
	}

```

It doesn’t work either.

How can i perform this?

Best regards

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:** [June 22, 2014, 10:42pm UTC](https://community.wowza.com/t/imediastreamactionnotify2-or-imoduleonstream-doesnt-detect-stream-publishin/40015/2 "2014-06-22T22:42:19Z")

</div>

Hi Richard,

This won’t work because HTTPProviderBase only provides an HTTP interface to Wowza, HTTP request and response. It is not a long running process that you can setup notifiers with. You can use an [application Module](https://www.wowza.com/docs/how-to-use-imediastreamactionnotify3-interface-to-listen-for-rtmp-stream-events-includes-codec-info%28includes-codec-info%29) or ServerListener.

Richard

---

<div class="post-metadata">

**Author:** ![Richard\_Perez](https://avatars.discourse-cdn.com/v4/letter/r/48db29/32.png) [@Richard\_Perez](https://community.wowza.com/u/Richard_Perez)\
**Post date:** [June 23, 2014, 12:28am UTC](https://community.wowza.com/t/imediastreamactionnotify2-or-imoduleonstream-doesnt-detect-stream-publishin/40015/3 "2014-06-23T00:28:10Z")

</div>

> Hi Richard,
> 
> This won’t work because HTTPProviderBase only provides an HTTP interface to Wowza, HTTP request and response. It is not a long running process that you can setup notifiers with. You can use an [application Module](https://www.wowza.com/docs/how-to-use-imediastreamactionnotify3-interface-to-listen-for-rtmp-stream-events-includes-codec-info%28includes-codec-info%29) or ServerListener.
> 
> Richard

Thank you for your answer Richard.

I tried the following. In the same java file as my HTTPProvider i add the following class :

```auto
class StreamListener extends ModuleBase
{
	public void onStreamCreate(IMediaStream stream)
	{
		getLogger().info("DETECT CREATION");
	}
	public void onStreamDestroy(IMediaStream stream)
	{
		getLogger().info("DETECT DESTRUCTION");
	}
}

```

Then in my HTTPProvider i add:

```auto
private StreamListener test = new StreamListener();

```

It doesn’t seems to work either. Am i obliged to create a new independant module?

Best regards

Richard

---

<div class="post-metadata">

**Author:** ![Richard\_Perez](https://avatars.discourse-cdn.com/v4/letter/r/48db29/32.png) [@Richard\_Perez](https://community.wowza.com/u/Richard_Perez)\
**Post date:** [June 30, 2014, 2:00am UTC](https://community.wowza.com/t/imediastreamactionnotify2-or-imoduleonstream-doesnt-detect-stream-publishin/40015/4 "2014-06-30T02:00:23Z")

</div>

Ok so it doesn’t work with a nested class. You need to provide a full independent module.
