流媒体技术世界——分享技术,增值服务
用IMediaCasterNotify2接口对MediaCaster流进行事件监听
这篇文章介绍了如何用IMediaCasterNotify2接口来实现对MediaCaster流的事件监听:

package com.wowza.wms.example.module;

import com.wowza.wms.application.*;
import com.wowza.wms.mediacaster.IMediaCaster;
import com.wowza.wms.mediacaster.IMediaCasterNotify2;
import com.wowza.wms.module.*;
import com.wowza.wms.stream.IMediaStream;
import com.wowza.wms.stream.IMediaStreamPlay;

public class ModuleMediaCasterNotifyExample extends ModuleBase {

	public void onAppStart(IApplicationInstance appInstance) {
		String fullname = appInstance.getApplication().getName() + "/"
				+ appInstance.getName();
		getLogger().info("onAppStart: " + fullname);
		appInstance.addMediaCasterListener(new mediacasterNotify());
	}

	public void onAppStop(IApplicationInstance appInstance) {
		String fullname = appInstance.getApplication().getName() + "/"
				+ appInstance.getName();
		getLogger().info("onAppStop: " + fullname);
	}
	
	class mediacasterNotify implements  IMediaCasterNotify2
	{

		public void onConnectFailure(IMediaCaster mediaCaster) {
			
			getLogger().info("onConnectFailure");
		}

		public void onConnectStart(IMediaCaster mediaCaster) {
			
			getLogger().info("onConnectStart");
			
		}

		public void onConnectSuccess(IMediaCaster mediaCaster) {
			
			getLogger().info("onConnectSuccess");
		}

		public void onStreamStart(IMediaCaster mediaCaster) {
			
			getLogger().info("onStreamStart");
		}

		public void onStreamStop(IMediaCaster mediaCaster) {
			
			getLogger().info("onStreamStop");
		}

		public void onMediaCasterCreate(IMediaCaster mediaCaster) {
			
			getLogger().info("onMediaCasterCreate");
		}

		public void onMediaCasterDestroy(IMediaCaster mediaCaster) {
			
			getLogger().info("onMediaCasterDestroy");
		}

		public void onRegisterPlayer(IMediaCaster mediaCaster,
				IMediaStreamPlay player) {
			
			getLogger().info("onRegisterPlayer");
		}

		public void onSetSourceStream(IMediaCaster mediaCaster,
				IMediaStream stream) {
			
			getLogger().info("onSetSourceStream");
		}

		public void onUnRegisterPlayer(IMediaCaster mediaCaster,
				IMediaStreamPlay player) {
			
			getLogger().info("onUnRegisterPlayer");
		}
		
	}

}



匿名用户
评论

我们的地址


北京市朝阳区管庄西里建基商务楼423室


邮编:100024

关于我们


北京联方信科信息技术有限责任公司


官网:www.ttstream.com

联系我们


王经理:phone


柳经理:phone

京ICP备14033868号-2