User Guide

158 Server-Side ActionScript Language Reference
Stream.setVirtualPath()
Availability
Flash Media Server 2.
Usage
myStream.setVirtualPath(virtualPath, directory, virtualKey)
Parameters
virtualPath A string indicating the virtual directory path of a stream. If the stream is not
located in the virtual path, the default virtual directory path is searched.
strDirectory A string indicating the physical directory in which to store streams.
virtualKey A string that sets or removes the key value for each virtual path entry.
Returns
Nothing.
Description
Method; sets or removes the virtual directory path for video stream playback.
Flash Media Server can deliver two video codecs to clients: Sorenson Spark and the On2 VP6
codec. Flash Player 8 supports both codecs; Flash Player 7 and earlier supports only Sorenson
Spark. You can use the
Stream.setVirtualPath() method to dynamically serve Flash Player
8 clients a better version of a video stream.
When Flash Player requests a stream from Flash Media Server, the Flash Player version
determines the server-side
Client.virtualKey property (typically a mapping of the Flash
Player version). Flash Media Server then serves the client a stream from whichever virtual
directory the virtual key is mapped to. For example, if the client is Flash Player 8, the virtual
key might map to the On2 streams directory, and the client would be served a higher quality
stream. If the client is Flash Player 7, the virtual key might map to the default stream
directory. This feature allows you to serve the same content to all clients in the optimum
encoding for each client’s platform.
The mapping between the virtual keys and virtual directories is made in the vhost.xml file.
(For more information about the vhost.xml file, see “The Vhost.xml file” in Managing Flash
Media Server). When you call
setVirtualPath(), you are changing values in the
VirtualDirectory tag of that file.