How to override publish to remap a stream name

The following example shows how to change the name of the stream being published. In this example, the stream named "myStream" is changed to "yourStream".
 

package com.wowza.wms.example.module;

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

public class ModuleOverridePublishRemapStream extends ModuleBase {

	public void publish(IClient client, RequestFunction function,
	        AMFDataList params) {
		getLogger().info("Overriding Publish");

		String streamName = getParamString(params, PARAM1);

		if (streamName.startsWith("myStream"))
				params.set(PARAM1, "yourStream");

		invokePrevious(client, function, params);
	}

public void releaseStream(IClient client, RequestFunction function, AMFDataList params)
	{
		String streamName = getParamString(params, PARAM1);

		if (streamName.startsWith("myStream"))
				params.set(PARAM1, "yourStream");

		invokePrevious(client, function, params);
	}

}

Originally Published: 10-03-2010.

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