ActionScript 2.0 Components Language Reference |
|
|
|
| FLVPlayback Component > FLVPlayback class > FLVPlayback.bitrate | |||
Flash Player 8.
Flash Professional 8.
my_FLVplybk.bitrate
Property; a number that specifies the bits per second at which to transfer the FLV file.
When doing a progressive download, you can use the SMIL format, but you must set the bit rate because there is no automatic detection.
When streaming video from a FMS, you can provide a SMIL file that describes how to switch between multiple streams based on bandwidth. Bandwidth is automatically detected by FMS, and, in this case, bitrate is ignored, if it is set.
For more information on using a SMIL file, see Using a SMIL file.
The following example checks two radio buttons to determine what bit rate to use when selecting an FLV file from the specified SMIL file. The relevant video tags in the SMIL file are shown in the following code:
<switch>
<video src="myvideo_mdm.flv" system-bitrate="56000" dur="3:00.1">
<video src="myvideo_isdn.flv" dur="3:00.1">
</switch>
For a low-speed connection, the code sets the bitrate property to force selection of the appropriate FLV file. For higher speed connections, it takes advantage of automatic bandwidth detection for streaming from FMS and does not set the bit rate.
Drag an FLVPlayback component to the Stage, and give it an instance name of my_FLVPlybk. Drag a RadioButton component and then a Label component to the Library panel. Then add the following code to the Actions panel on Frame 1 of the Timeline. In the statement that loads the contentPath property, replace the italicized text with the name and location of your SMIL file.
/**Requires:- FLVPlayback component in the Library- RadioButton component in the Library- Label component in the Library*/import mx.video.*;import mx.controls.*;this.createClassObject(Label, "my_prompt", 10);my_prompt.text = "Please indicate your connection speed: ";this.createClassObject(RadioButton, "dialup", 20, {label:"Dialup modem (56 KB)", groupName:"radioGroup"});this.createClassObject(RadioButton, "isdn", 30, {label:"ISDN (128 KB)", groupName:"radioGroup"});my_prompt.autoSize = "left";dialup.setSize(200, 30);isdn.setSize(200, 30);// Position RadioButtons on Stage.my_prompt.move(my_FLVPlybk.x, my_FLVPlybk.y + my_FLVPlybk.height + 40);dialup.move(my_FLVPlybk.x, my_prompt.y + my_prompt.height + 5);isdn.move(my_FLVPlybk.x, dialup.y + 15);// Create listener objectvar rbListener:Object = new Object();rbListener.click = function(eventObject:Object){if(dialup.selected) { // for modemmy_FLVPlybk.bitrate = 56000;} // for isdn (or higher bandwidths) allow automatic detection}// Add listenerradioGroup.addEventListener("click", rbListener);my_FLVPlybk.contentPath = "http://www.someserver.com/video/sample.smil";
|
|
|
|