如何采用服务端API对rtsp流的播放请求进行访问控制?
转载请注明:文章来自www.wowza.cn
注意: 要访问最新的技术资料,请访问http://www.ttstream.com/wowza/
下面的代码例子展现了如何使用服务端API对RTSP/RTP流媒体播放请求进行控制。

Code:
package com.wowza.wms.example.module;

import com.wowza.wms.rtp.model.*;
import com.wowza.wms.application.*;
import com.wowza.wms.module.*;

public class ModuleAccessControlRTSP extends ModuleBase
{
	public void onRTPSessionCreate(RTPSession rtpSession)
	{
		boolean isGood = true;

		String ipAddress = rtpSession.getIp();
		String queryStr = rtpSession.getQueryStr();
		String referrer = rtpSession.getReferrer();
		String userAgent = rtpSession.getUserAgent();
		
		IApplicationInstance appInstance = rtpSession.getAppInstance();
		String uriStr = rtpSession.getUri();
		
		// Here you can use the request and session information above to determine 
		// if you want to reject the connection
		// isGood = true/false;
		
		if (!isGood)
			rtpSession.rejectSession();
	}
}
www.wowza.cn