Bitrate and Buffer ActionScript APIs (Player V2 Deprecated)
The Bitrate Selection API allows developers to programmatically obtain current buffer size, as well as get and set bitrates.
ActionScript Bitrate Selection API
- select a bitrate based on its quality (auto, low, medium, or high). For example, if you set the bitrate quality to high, the player will decide which is the highest available encoding.
- select a bitrate based on its kbps number (sum of both audio and video encodings). For example, consider a video with the following available bitrates: [600 kbps, 1000 kbps, 3000 kbps, 4000 kbps]. You can set the bitrate quality to be any of those values.
ActionScript Bitrate Selection Functions
The following table describes all the ActionScript methods (a function invoked through an object) that are associated with bitrates and buffers.
Get the target bitrate, in kbps, when target bitrate was previously set, or -1 otherwise.
Return Values: kbps | -1
Set the target bitrate, in kbps. The input needs to be an available bitrate. Available bitrates can be determined by a call to getBitratesAvailable(). Note that this setting does not carry over from video to video.
Example: Consider a channel with two videos, the first with highest bitrate of 1000 kbps, and the second with medium bitrate of 1000 kbps and highest bitrate of 2000 kbps. If you set bitrate to 1000 kbps, we will convert this number to a bitrate quality, which in this case in high. Since bitrate quality carries over, the first video will play at 1000 kbps, and the second video will play at 2000 kbps, which is its highest bitrate.
Returns an array of strings.
Type: string array
Return Value: An array of variable size. The size of the array is dependent on the number of encodings available:
Returns an array with the total number of bitrates, in kbps, or an empty array when the number of encodings is not available.
Type: Integer array
Examples: [250, 500, 1000] indicates that three bitrates are available: 250 kbps, 500 kbps and 1000 kbps.
Get the target bitrate quality.
Return Values: One of auto, low, medium or high.
Returns the current size of the buffer in seconds, when buffer length is supported, or 0 otherwise. Currently, YouTube Assets and Remote Assets do not support buffer length.
Return Values: time in seconds | 0
Set the target bitrate quality.
Return Values: one of the following
Example: Consider a channel with two videos, the first with highest bitrate of 1000 kbps, and the second with medium bitrate of 1000 kbps and highest bitrate of 2000 kbps. If you set bitrate quality to high, the first video will play at 1000 kbps, and the second video will play at 2000 kbps, which is its highest bitrate.
ActionScript Bitrate Selection EventsThe following table describes all the ActionScript events that are associated with bitrates.
The target bitrate has changed.
|targetBitrateQualityChanged||The target bitrate quality has changed.|
The following list provides links to Backlot documentation that provides some general information about bitrates and buffering.