How to control access to Apple HLS streaming (cupertinostreaming)

Example module that illustrates the basic API for controlling access to an Apple HLS stream.

package com.wowza.wms.example.module;

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

public class ModuleAccessControlCupertinoStreaming extends ModuleBase
{
	public void onHTTPCupertinoStreamingSessionCreate(HTTPStreamerSessionCupertino httpCupertinoStreamingSession)
	{
		boolean isGood = true;

		String ipAddressClient = httpCupertinoStreamingSession.getIpAddress();
		String ipAddressServer = httpCupertinoStreamingSession.getServerIp();
		String queryStr = httpCupertinoStreamingSession.getQueryStr();
		String referrer = httpCupertinoStreamingSession.getReferrer();
		String cookieStr = httpCupertinoStreamingSession.getCookieStr();
		String userAgent = httpCupertinoStreamingSession.getUserAgent();

		IApplicationInstance appInstance = httpCupertinoStreamingSession.getAppInstance();
		String streamName = httpCupertinoStreamingSession.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("ModuleAccessControlCupertinoStreaming.onHTTPCupertinoStreamingSessionCreate["+appInstance.getContextStr()+":"+streamName+"]: accept:"+isGood);

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

Originally Published: 10-03-2010.

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