Many Flash based players (FLVPlayback component being one) will use a single RTMP url to both connect to Wowza Media Server and play a particular stream. In reality this url is broken into two pieces; server connection url and stream name. The expanded format of this url assuming the stream is located at the path [path1]/[path2]/[streamName] takes the form:
rtmp://[wowza-ip-or-domain]:[port]/[application]/[appInstance]/[prefix]:[path1]/[path2]/[streamName]
Where:
-
[wowza-ip-or-domain]: Wowza Media Server domain name or ip address
-
[port]: Is the TCP port to use for the connection (rtmp & rtmpe = 1935, rtmpt = 80, rtmps = 443)
-
[application]: Application name
-
[appInstance]: Application instance name (defaults to definst)
-
[prefix]: Content type prefix (flv, mp4, mp3 - defaults to flv if omitted)
-
[path1]/[path2]/[streamName]: Stream path and name
If the stream name does not contain any path elements, then the url can be shortened to (omitting [appInstance] part):
rtmp://[wowza-ip-or-domain]:[port]/[application]//[prefix]:[streamName]
The important point here is if the stream name contains path elements then the full url format must be used. In most cases this means adding definst just after the [application] name.
Examples:
(these examples assume the Wowza server is running at the domain name mycompany.com on TCP port 1935)
If application name is vod and stream name is mycoolvideo.mov then the rtmp url is:
rtmp://mycompany.com/vod/mp4:mycoolvideo.mov or: rtmp://mycompany.com/vod/_definst_/mp4:mycoolvideo.mov
If application name is vod and stream name is myvideos/mycoolvideo.mov then the rtmp url is:
rtmp://mycompany.com/vod/_definst_/mp4:myvideos/mycoolvideo.mov
Note: The short form cannot be used.
Note: Another issue are the query parameters that are attached to a url such as:
rtmp://mycompany.com/vod/mp4:mycoolvideo.mov?param1=value1¶m2=value2
Because of the way most single url players break apart the stream url, the query parameters will be attached to the stream name and not the connection url. For this reason the query parameters will not be available in the onConnect handler. For example the url above will most likely be broken into the server url and stream name as follows:
Server: rtmp://mycompany.com/vod Stream: mp4:mycoolvideo.mov?param1=value1¶m2=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); }
Charlie