Wowza Community

Sending parameters when using IMediaStreamNameAliasProvider

I have PlaybackCDN class which is returning the URL from another Wowza server. As you can see I send the token in the URL, but when the play method is called I receive just the stream name, without any token. How can I send the parameters?

 public class PlaybackCDN  extends CDNBase implements IMediaStreamNameAliasProvider{

	private static WMSLogger log = WMSLoggerFactory.getLogger(null);

	

	public void onAppStart(IApplicationInstance appInstance) {

		appStart(appInstance);

		appInstance.setStreamNameAliasProvider(this);

	}

	

	@Override

	public String resolvePlayAlias(IApplicationInstance arg0, String arg1) {

		log.error("In resolvePlayAlias: " + arg1);

		StreamParams params = getParamsFromQuery(arg1);

		

		try {

			streamSource = validatePlaybackURL(params);

		} catch (Exception e) {

			log.error("Error calling the API to get CDN info for" + params.getStreamName() );

			log.error(e.toString());

		}

		

		String sourceUrl = "wowz://" + streamSource.getPlaybackHostname() + ":" + streamSource.getPlaybackPort() + "/" + streamSource.getPlaybackApplicationName() + "?token=" + streamSource.getToken() + "/" + streamSource.getStreamName();

		log.info("resolve source url: "+ sourceUrl);

		

		return sourceUrl;

	}

	@Override

	public String resolveStreamAlias(IApplicationInstance arg0, String arg1) {

		log.error("In resolveStreamAlias: " + arg1);

	

		String sourceUrl = "wowz://" + streamSource.getPlaybackHostname() + ":" + streamSource.getPlaybackPort() + "/" + streamSource.getPlaybackApplicationName() + "?token=" + streamSource.getToken() + "/" + streamSource.getStreamName();

		log.info("resolve source url: "+ sourceUrl);

		

		return sourceUrl;

	}

}

Hello,

It looks like this question was discussed in a ticket with support.

I am posting the latest suggestion from our developers.

“The best way to add token querystring parameters in your resolvePlayAlias method is to url encode or base64 encode the parameters in the stream name, and then decode them. You will need to ensure that you encode the ? and & characters.”

I hope that helped to resolved the issue.

Regards,

Andy E.