How to control access to MPEG-DASH streaming (mpegdashstreaming)

Example module that illustrates the basic 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();
	}

}

Originally Published: 01-07-2015.

If you're having problems or want to discuss this article, post in our forum.