How to control access to Microsoft Smooth Streaming (smoothstreaming)

Example module that illustrates the basic API for controlling access to a Microsoft Smooth Streaming stream.

package com.wowza.wms.example.module;

import com.wowza.wms.application.IApplicationInstance;
import com.wowza.wms.httpstreamer.smoothstreaming.httpstreamer.*;
import com.wowza.wms.module.*;

public class ModuleAccessControlSmoothStreaming extends ModuleBase
{
	public void onHTTPSmoothStreamingSessionCreate(HTTPStreamerSessionSmoothStreamer httpSmoothStreamingSession)
	{
		boolean isGood = true;

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

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

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

}

Originally Published: 10-03-2010.

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