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

Note: Ooyala Player V2 has been deprecated and is scheduled to be disabled. For details and alternatives, see the OVP Release Notes.
To select a bitrate, you have the option of using two different workflows:
  • 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:

  • When only one encoding is available, the function returns [‘auto’]
  • When two encodings are available, the function returns [‘auto’,’low’,’high’]
  • When three or more encodings are available, the function returns [‘auto’,’low’, ‘medium’, ’high’]
  • When no bitrate quality information is available, the function returns [‘auto’]
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

  • auto—use adaptive bitrate algorithms to provide the best bitrate given the user’s current bandwidth and CPU usage. This setting carries over from video to video within a particular embed.
  • low—lowest bitrate available
  • medium—median of all bitrates available
  • high—highest bitrate available

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.

Was this article helpful?