How to send FCSubscribe to CDN (ModuleFCSubscribe)

Some client-side code that is intended for use in a CDN environment (such as the Open Video Player) requires an implementation of FCSubscribe to work properly. This module is a simple implementation of this server-side method.

Note: This module has been removed from the Wowza Module Collection because it has been replaced by a core method. See ModuleCore.FCSubscribe(IClient client, RequestFunction function, AMFDataList params) in the Wowza Streaming Engine Server-Side API documentation. The source code has been retained here for reference.
package com.wowza.wms.plugin.test.module;

import com.wowza.wms.amf.*;
import com.wowza.wms.client.*;
import com.wowza.wms.request.*;
import com.wowza.wms.response.*;
import com.wowza.wms.module.*;

public class ModuleFCSubscribe extends ModuleBase
	public void FCSubscribe(IClient client, RequestFunction function, AMFDataList params)
		String streamName = params.getString(PARAM1);

		IMediaStream stream = null;
		if (streamName != null)
			stream = client.getAppInstance().getStreams().getStream(streamName);

		String responseCode = (stream == null)?"NetStream.Play.StreamNotFound":"NetStream.Play.Start";

		AMFDataObj data = null;
		ResponseFunction resp = null;
		ResponseFunctions respFunctions = client.getRespFunctions();
		double clientID = client.getClientId();

		resp = new ResponseFunction(client);
		resp.createDefaultMessage("onFCSubscribe", 0.0);

		data = new AMFDataObj();
		data.put("level", new AMFDataItem("status"));
		data.put("code", new AMFDataItem(responseCode));
		data.put("clientid", new AMFDataItem((double)clientID));


Use the Wowza IDE to compile this into a module, then add the following <Module> as the last entry in the <Modules> list.

Wowza media server software and all components, including modules, source code, and other related items offered on this page, are copyrighted (c) 2006-2014 by Wowza Media Systems, LLC, all rights reserved, and are licensed pursuant to the Wowza Media Software End User License Agreement.
Originally Published: 10-03-2010.
Updated: For Wowza Streaming Engine on 02-26-2014.

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