Try this:
package
import com.wowza.wms.amf.AMFDataItem;
import com.wowza.wms.amf.AMFDataObj;
import com.wowza.wms.amf.AMFPacket;
import com.wowza.wms.application.WMSProperties;
import com.wowza.wms.module.*;
import com.wowza.wms.stream.IMediaStream;
import com.wowza.wms.stream.IMediaStreamActionNotify;
import com.wowza.wms.stream.IMediaStreamActionNotify2;
public class MediaStreamActionNotify2Example extends ModuleBase {
public void onStreamCreate(IMediaStream stream) {
getLogger().info("onStreamCreate by: " + stream.getClientId());
IMediaStreamActionNotify 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());
IMediaStreamActionNotify actionNotify = null;
WMSProperties props = stream.getProperties();
synchronized(props)
{
actionNotify = (IMediaStreamActionNotify)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)
{
}
public void onMetaData(IMediaStream stream, AMFPacket metaDataPacket)
{
}
public void onPauseRaw(IMediaStream stream, boolean isPause, double location)
{
}
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("onUN Publish");
}
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");
}
}
}
Richard