The URI to the application can be absolute or relative and has the following syntax (items in brackets are optional):
protocol:[//host][:port]/appname/[instanceName]
The parts of the URI are described in the following table.
|
Part |
Example |
Description |
|---|---|---|
|
protocol: |
rtmp: |
The protocol used to connect to Adobe Flash Media Server, which is the Adobe Real-Time Messaging Protocol. Possible values are rtmp, rtmpe, rtmps, rtmpt, and rtmpte. For more information, see the Technical Overview. |
|
//host |
//www.example.com |
The host name of a local or remote computer. To connect to a server on the same host computer as the client, use //localhost or omit the //host identifier. |
|
:port |
:1935 |
The port number to connect to on Adobe Flash Media Server. If the protocol is rtmp, the default port is 1935 and you don't need to specify the port number. |
|
/appname/ |
/sudoku/ |
The name of a subdirectory in RootInstall/applications, where your application files reside. You can specify another location for your applications directory in the fms.ini configuration file (at RootInstall/conf/fms.ini). |
|
instanceName |
room1 |
An instance of the application to which the client connects. For example, a chat room application can have many chat rooms: chatroom/room1, chatroom/room2, and so on. If you do not specify an instance name, the client connects to the default application instance, named _definst_. |
The only parts of the URI that are required are the protocol and the application name, as in the following:
rtmp://www.example.com/sudoku/
In the following example, the client is on the same computer as the server, which is common while you are developing and testing applications:
rtmp:/sudoku/room1
Flash Media Server simplifies the mapping of URIs to local and network drives by using virtual directories. Virtual directories let you publish and store media files in different, predetermined locations, which can help you organize your media files. Configure virtual directories in the VirtualDirectory/Streams tag of the Vhost.xml file. For more information, see Mapping virtual directories to physical directories in the Configuration and Administration Guide.
One way you can use directory mapping is to separate storage of different kinds of resources. For example, your application could allow users to view either high-bandwidth video or low-bandwidth video, and you might want to store high-bandwidth and low-bandwidth video in separate folders. You can create a mapping wherein all streams that start with low are stored in a specific directory, C:\low_bandwidth, and all streams that start with high are stored in a different directory:
<VirtualDirectory>
<Streams>low;c:\low_bandwidth</Streams>
<Streams>high;c:\high_bandwidth</Streams>
</VirtualDirectory>
When the client wants to access low-bandwidth video, the client calls ns.play("low/sample"). This call tells the server to look for the sample.flv file in the c:\low_bandwidth folder.
Similarly, a call to ns.play("high/sample") tells the server to look for the sample.flv file in the c:\high_bandwidth folder.
The following table shows three examples of different virtual directory configurations, including mapping to a local drive and a network drive, and how the configurations determine the directory to which a recorded stream is published. In the first case, because the URI specified ("myStream") does not match the virtual directory name that is specified ("low"), the server publishes the stream to the default streams directory.
|
Mapping in Vhost.xml |
URI in NetStream call |
Location of published stream |
|---|---|---|
|
low;e:\fmsstreams |
"myStream" |
c:\...\RootInstall\applications\yourApp\streams\_definst_\myStream.flv |
|
low;e:\fmsstreams |
"low/myStream" |
e:\fmsstreams\myStream.flv |
|
low;\\mynetworkDrive\share\fmsstreams |
"low/myStream" |
\\mynetworkDrive\share\fmsstreams\myStream.flv |