How to override play to remap a stream name

Note: This article is for an older Wowza™ product or technology that either has been updated or is no longer supported. For the current version of this article, see How to modify or control a stream by overriding playback.
 
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.*;

public class ModuleOverridePlayRemapStream extends ModuleBase {

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

		String streamName = getParamString(params, PARAM1);

		if (streamName.equalsIgnoreCase("test"))
				params.set(PARAM1, "sample.mp4");

		invokePrevious(client, function, params);
	}
}