Hi !
I am creating a new Module to Wowza, and i need use Listener Stream, but by some reason the events aren’t called when start play video or stop.
I added Module in Application.xml of my Application and i debbuged my code and saw that class is being calling, but events not
Please, help me.
My Code:
package com.movile.wowza.session.user;
import com.wowza.wms.application.*;
import com.wowza.wms.amf.*;
import com.wowza.wms.client.*;
import com.wowza.wms.media.model.MediaCodecInfoAudio;
import com.wowza.wms.media.model.MediaCodecInfoVideo;
import com.wowza.wms.module.*;
import com.wowza.wms.request.*;
import com.wowza.wms.stream.*;
import com.wowza.wms.rtp.model.*;
import com.wowza.wms.httpstreamer.model.*;
import com.wowza.wms.httpstreamer.cupertinostreaming.httpstreamer.*;
import com.wowza.wms.httpstreamer.smoothstreaming.httpstreamer.*;
public class SessionUser extends ModuleBase {
public void doSomething(IClient client, RequestFunction function, AMFDataList params) {
getLogger().info("doSomething");
sendResult(client, params, "Hello Wowza");
}
public void onAppStart(IApplicationInstance appInstance) {
String fullname = appInstance.getApplication().getName() + "/" + appInstance.getName();
getLogger().info("onAppStart: " + fullname);
}
public void onAppStop(IApplicationInstance appInstance) {
String fullname = appInstance.getApplication().getName() + "/" + appInstance.getName();
getLogger().info("onAppStop: " + fullname);
}
public void onConnect(IClient client, RequestFunction function, AMFDataList params) {
getLogger().info("onConnect: " + client.getClientId());
}
public void onConnectAccept(IClient client) {
getLogger().info("onConnectAccept: " + client.getClientId());
}
public void onConnectReject(IClient client) {
getLogger().info("onConnectReject: " + client.getClientId());
}
public void onDisconnect(IClient client) {
getLogger().info("onDisconnect: " + client.getClientId());
}
public void onStreamCreate(IMediaStream stream) {
getLogger().info("onStreamCreate: " + stream.getSrc());
IMediaStreamActionNotify2 actionNotify = new StreamListener();
//StreamListener actionNotify = new StreamListener();
WMSProperties props = stream.getProperties();
synchronized (props)
{
props.put("streamActionNotifier", actionNotify);
}
stream.addClientListener(actionNotify);
}
public void onStreamDestroy(IMediaStream stream) {
getLogger().info("onStreamDestroy: " + stream.getSrc());
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());
}
}
public void onHTTPSessionCreate(IHTTPStreamerSession httpSession) {
getLogger().info("onHTTPSessionCreate: " + httpSession.getSessionId());
System.out.println("Query String Create " + httpSession.getQueryStr());
//httpSession.setPlayStart(20000);
}
public void onHTTPSessionDestroy(IHTTPStreamerSession httpSession) {
getLogger().info("onHTTPSessionDestroy: " + httpSession.getSessionId());
}
class StreamListener implements IMediaStreamActionNotify2
{
@Override
public void onPause(IMediaStream stream, boolean isPause, double location) {
System.out.println("onPause");
}
@Override
public void onPlay(IMediaStream stream, String streamName, double playStart, double playLen, int playReset) {
System.out.println("onPlay");
}
@Override
public void onPublish(IMediaStream stream, String streamName, boolean isRecord, boolean isAppend) {
System.out.println("onPublish");
}
@Override
public void onSeek(IMediaStream stream, double location) {
}
@Override
public void onStop(IMediaStream stream) {
System.out.println("onStop");
}
@Override
public void onUnPublish(IMediaStream stream, String streamName, boolean isRecord, boolean isAppend) {
// TODO Auto-generated method stub
}
@Override
public void onMetaData(IMediaStream stream, AMFPacket metaDataPacket) {
// TODO Auto-generated method stub
}
@Override
public void onPauseRaw(IMediaStream stream, boolean isPause, double location) {
// TODO Auto-generated method stub
}
}
}