Control access to MPEG-DASH streaming with the Wowza Streaming Engine Java API

The following mpegdashstreaming example module illustrates how to use the Wowza Streaming Engine™ Java API for controlling access to an MPEG-DASH stream.

package com.wowza.wms.example.module;

import com.wowza.wms.httpstreamer.mpegdashstreaming.httpstreamer.*;
import com.wowza.wms.module.*;
import com.wowza.wms.application.*;

public class ModuleAccessControlMPEGDashStreaming extends ModuleBase
{
	public void onHTTPMPEGDashStreamingSessionCreate(HTTPStreamerSessionMPEGDash httpMPEGDashStreamingSession)
	{
		boolean isGood = true;

		String ipAddress = httpMPEGDashStreamingSession.getIpAddress();
		String queryStr = httpMPEGDashStreamingSession.getQueryStr();
		String referrer = httpMPEGDashStreamingSession.getReferrer();
		String cookieStr = httpMPEGDashStreamingSession.getCookieStr();
		String userAgent = httpMPEGDashStreamingSession.getUserAgent();

		IApplicationInstance appInstance = httpMPEGDashStreamingSession.getAppInstance();
		String streamName = httpMPEGDashStreamingSession.getStreamName();

		// Here you can use the request and session information above to determine
		// if you want to reject the connection
		// isGood = true/false;
		getLogger().info("ModuleAccessControlMPEGDashStreaming.onHTTPMPEGDashStreamingSessionCreate["+appInstance.getContextStr()+"/"+streamName+"]: accept:"+isGood);

		if (!isGood)
			httpMPEGDashStreamingSession.rejectSession();
	}

}