To
handle multiple streams for multiple bandwidths, the VideoPlayer
class uses a helper class (NCManager) that supports a subset of
SMIL. SMIL is used identify the location of the video stream, the
layout (width and height) of the FLV file, and the source FLV files
that correspond to the different bandwidths. It can also be used
to specify the bit rate and duration of the FLV file.
Use the
source
parameter or the FLVPlayback.source
property (ActionScript) to specify the location of a SMIL file.
For more information, see
Specify the FLVPlayback source parameter
and the
FLVPlayback.source
property
in the
ActionScript 3.0 Reference for the Adobe
Flash Platform
.
The following example shows a SMIL file that streams multiple
bandwidth FLV files from a FMS using RTMP:
<smil>
<head>
<meta base="rtmp://myserver/myapp/" />
<layout>
<root-layout width="240" height="180" />
</layout>
</head>
<body>
<switch>
<ref src="myvideo_cable.flv" dur="3:00.1"/>
<video src="myvideo_isdn.flv" system-bitrate="128000" dur="3:00.1"/>
<video src="myvideo_mdm.flv" system-bitrate="56000"dur="3:00.1"/>
</switch>
</body>
</smil>
The
<head>
tag may contain the
<meta>
and
<layout>
tags.
The
<meta>
tag supports only the
base
attribute,
which is used to specify the URL of the streaming video (RTMP from
a FMS).
The
<layout>
tag supports only the
root-layout
element,
which is used to set the
height
and
width
attributes,
and, therefore, determines the size of the window in which the FLV
file is rendered. These attributes accept only pixel values, not
percentages.
Within the body of the SMIL file, you can either include a single
link to a FLV source file or, if you’re streaming multiple files
for multiple bandwidths from a FMS (as in the previous example),
you can use the
<switch>
tag to list the source
files.
The
video
and
ref
tags within
the
<switch>
tag are synonymous—they both
can use the
src
attribute to specify FLV files.
Further, each can use the
region
,
system-bitrate
,
and
dur
attributes to specify the region, the minimum
bandwidth required, and the duration of the FLV file.
Within the
<body>
tag, only one occurrence
of either the
<video>
,
<src>
,
or
<switch>
tag is allowed.
The following example shows a progressive download for a single
FLV file that does not use bandwidth detection:
<smil>
<head>
<layout>
<root-layout width="240" height="180" />
</layout>
</head>
<body>
<video src=""myvideo.flv" />
</body>
</smil>