Format Adobe Flash RTMP URLs for Wowza Streaming Engine

Some Flash-based players use a single RTMP URL to connect to Wowza Streaming Engine™ media server software and to play a stream. This URL has two parts: the server connection components and the stream name. The expanded format of this URL, assuming the stream is located at the [path1]/[path2]/[streamName] takes the form:

rtmp://[wowza-ip-address]:[port]/[application]/[appInstance]/[prefix]:[path1]/[path2]/[streamName]

Where:

  • [wowza-ip-address] is the domain name or IP address of the Wowza Streaming Engine server
  • [port] is the TCP port to use for the connection: RTMP/RTMPE uses 1935, uses RTMPT 80; RTMPS uses 443
  • [application] is the application name
  • [appInstance] is the name of the application instance (defaults to _definst_)
  • [prefix] is the content type prefix: flv, mp4, or mp3. Defaults to mp4 if omitted.
  • [path1]/[path2]/[streamName] is the path and stream name

If the stream name doesn't have path elements, the application instance can be omitted:

rtmp://[wowza-ip-address]:[port]/[application]/[prefix]:[streamName]
If the stream name does have path elements, the full URL format must be used. In most cases this means adding _definst_ just after the application name.

Here are some example URLs, all of which assume that Wowza Streaming ENgine is running at the domain mycompany.com on TCP port 1935.

RTMP URL for application vod and stream mycoolvideo.mov

rtmp://mycompany.com/vod/mp4:mycoolvideo.mov

or

rtmp://mycompany.com/vod/_definst_/mp4:mycoolvideo.mov

RTMP URL for application vod and stream myvideos/mycoolvideo.mov

rtmp://mycompany.com/vod/_definst_/mp4:myvideos/mycoolvideo.mov
Note: The short form can't be used.

RTMP URL for application vod and stream  myvideos/mycoolvideo.mov (with query parameters)

Because of the way most single URL players break the stream URL, query parameters must be attached to the stream name and not the connection URL:

rtmp://mycompany.com/vod/_definst_/mp4:myvideos/mycoolvideo.mov?param1=value1&param2=value2

This means the query parameters aren't available in the onConnect handler. For example, the example URL above will most likely be broken into the server URL and stream name as follows:

Server: rtmp://mycompany.com/vod
Stream: mp4:myvideos/mycoolvideo.mov?param1=value1&param2=value2

The only place to intercept these query parameters is to override the play command. For example:

public void play(IClient client, RequestFunction function, AMFDataList params)
{
	String streamName = params.getString(PARAM1);

	String queryStr = "";
	int streamQueryIdx = streamName.indexOf("?");
	if (streamQueryIdx >= 0)
	{
		queryStr = streamName.substring(streamQueryIdx+1);
		streamName = streamName.substring(0, streamQueryIdx);
	}

	invokePrevious(client, function, params);
}