Detecting Stream Length - Adobe 65029121 - Flash Media Streaming Server Developer's Manual

Developer's guide
Hide thumbs Also See for 65029121 - Flash Media Streaming Server:
Table of Contents

Advertisement

Detecting stream length

About detecting stream length
The server-side Stream class allows you to detect the length of a recorded stream. The Stream class has a static
method,
, that returns the length in seconds of an audio or video stream. The length is measured by Adobe
length()
Flash Media Server and differs from the duration that
With
, you must specify the name of a stream. It can be an actual stream name, in a URI relative
Stream.length()
to the application instance used in
To use an actual stream name, for an application located in RootInstall/applications/dailyNews/ with the stream in
the dailyNews/streams/_definst_ subdirectory, call
length = Stream.length( "parade" );
length = Stream.length( "mp3:parade.mp3" );
length = Stream.length( "mp4:parade.mp4" );
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
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
// 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_.
Add a virtual key to the Streams element, for example:
2
<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.
Add a mapping between a virtual directory and a physical directory, for example:
3
<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
directory c:\data. The stream name
Get the length of a stream
This example shows how to have the server detect the length of a stream.
Note: Use the StreamLength sample, main.asc (Server-side ActionScript) and StreamLength.as (ActionScript 3.0).To
run the sample, see the general instructions in
NetConnection.connect()
Stream.length()
// for an FLV file
<VirtualDirectory>
just as with an actual stream name:
Stream.length()
videos/parade
Deploy an
returns, which is set by a user or a tool.
onMetaData
, or a virtual stream name.
like this:
// for an MP3 file
// for an MP4 file
and
<VirtualKeys>
maps to the physical file c:/data/parade.flv.
application.
ADOBE FLASH MEDIA SERVER
Developer Guide
in the Vhost.xml file.
to the physical
videos
36

Advertisement

Table of Contents
loading

This manual is also suitable for:

Flash media server

Table of Contents