Flash Media Server Developer Documentation

Virtual stream names

Stream names are not always unique on a server, so you can also use virtual stream names. With virtual stream names, multiple recorded streams can have the same name within different physical directories. You create a virtual stream name by configuring the values of <VirtualDirectory> and <VirtualKeys> in the Vhost.xml file.

The virtual stream name looks like an ordinary stream name, but can map to various locations on the server. With a virtual stream name, call Stream.length() just as with an actual stream name:

// this is a virtual stream name
length = Stream.length( "videos/parade" );

Edit Vhost.xml

A virtual stream name uses both a virtual key to identify the client and a virtual directory mapping. You only need to create a virtual stream mapping if the client uses a virtual stream name in its URI.

  1. Locate Vhost.xml in your server installation.

    By default, it is located at RootInstall/conf/_defaultRoot_/_defaultVHost_.

  2. Add a virtual key to the Streams element, for example:
    <Streams key="9">
    
    

    A virtual key is a mapping that chooses a Streams element to use. If the client attempting to play the stream has a key matching this virtual key, the server uses this virtual mapping.

  3. Add a mapping between a virtual directory and a physical directory, for example:
    <Streams key="9">videos;c:\data</Streams>
    
    

This maps all clients with a virtual key of 9 that are requesting streams whose URIs begin with videos to the physical directory c:\data. The stream name videos/parade maps to the physical file c:/data/parade.flv.