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.
Function | Description |
---|---|
targetBitrate() | Get the target bitrate, in kbps, when target bitrate was previously set, or -1 otherwise. Bindable Format: read-only Type: integer Return Values: kbps | -1 |
targetBitrate(bitrate) | 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. Non-bindable Format: write-only. Type: Number 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. |
bitrateQualitiesAvailable() | Returns an array of strings. Bindable Format: read-only. Type: string array Return Value: An array of variable size. The size of the array is dependent on the number of encodings available:
|
bitratesAvailable() | Returns an array with the total number of bitrates, in kbps, or an empty array when the number of encodings is not available. Bindable Format: Read-only Type: Integer array Examples: [250, 500, 1000] indicates that three bitrates are available: 250 kbps, 500 kbps and 1000 kbps. |
targetBitrateQuality() | Get the target bitrate quality. Bindable Format: read-only. Type: String Return Values: One of auto, low, medium or high. |
bufferLength() | 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. Type: Number Return Values: time in seconds | 0 |
targetBitrateQuality(quality) | Set the target bitrate quality. Non-Bindable Format: write-only. 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 Events
The following table describes all the ActionScript events that are associated with bitrates.Function | Description |
---|---|
targetBitrateChanged |
The target bitrate has changed. |
targetBitrateQualityChanged | The target bitrate quality has changed. |
Related Information
The following list provides links to Backlot documentation that provides some general information about bitrates and buffering.