ActionScript API Summary List (Player V2 Deprecated)

Lists and describes all Player ActionScript APIs grouped by Functions/Methods, Objects, Properties and Events.

Important: Ooyala Player V2 is deprecated and is scheduled to be disabled on 2018-01-31. After that date, Player V2 will no longer play your video or audio content. Customers still using Player V2 need to migrate to Player V4 (see Player V4.

This section of the document provides a class reference to the various ActionScript API functions, methods, properties, and events available through the ActionScript interface.

package com.ooyala.api

public class Player extends UIComponent

ActionScript Properties

The following table lists a describes the Ooyala Player ActionScript Properties. The property names are linked to topics with more detailed information.
Property Description

Returns info, channels, embed or syndication if the respective panel is currently shown.

CanRateCurrentItem Returns whether the current computer is allowed to rate the current item. This will be false if they have rated the current item before.
CurrentItemAverageRating Returns the average rating given to the item.
CurrentItemClosedCaptionsLanguages Gets a list of supported closed captions languages for the currently playing item.
CurrentItemRatings Returns the rating distribution for the current item.
closedCaptionsLanguage Sets the language of the closed captions which will be shown in the player.
currentItemEmbedCode Returns the embedCode of the active video in a channel.
currentItemTitle Returns the title of the active video.
description Returns the description of the player source.
embedCode Returns the embedCode of the player.
errorCode Returns the error code if the current state is error.
errorText Returns error text if the current state is error.
fullscreen Returns true if player is in fullscreen mode, false if not.
item Get an object describing the embedded item. The Object includes embedCode, title, description, time (play length in seconds), lineup, promo, and hostedAtURL.
lineup Returns an array of objects describing the current channel.
playheadTime Returns the current playhead position in seconds with millisecond accuracy.
queryStringParameters Returns the parameters for the object.
state Get current player state. One of playing, paused, buffering, channel, or error.
title Return the title of the channel if there is a channel, otherwise the title of the video.
totalTime Return the total length of current video in seconds, with millisecond accuracy.
volume Return the current volume as a number between 0 and 1 inclusive.

ActionScript Functions

The following table lists and describes the Ooyala Player ActionScript functions/methods.
Function/Method Description
changeCurrentItem(embedCode) Set the current video in a channel if the video is present. Returns true if accepted, false if not.
fetchMetadata(embedCode) Begins fetching the custom metadata for the given embedCode.

Begins fetching the related media for the given embedCode.

getTimedText(startTime, endTime) Returns the timed text (captions) which appear between the startTime and endTime.
getPromoFor(embedCode, width, height) Returns a promo image URL for the given embed code in a channel that will be at least the specified dimensions, or null for an embed code not present in the channel.
incrementCurrentItemRating(rating) Increments the rating for the current item. rating can be an integer from 0-10. If this computer has rated this item before, calling this function will have no effect.
load(), Load the Ooyala Player.
loadRatingsApi() Loads the Ratings API. The Ratings API should be loaded before calling any of the ratings API functions.
pauseMovie() Pause the current video.
playMovie() Play the current video.

ActionScript Events

The following table lists and briefly describes event notifications delivered to callback functions. Please note that inter-browser compatibility issues prevent use of standard DHTML events.
Event Name Description
activePanelChanged The active panel for Info, Embed, Share or Channel has been exposed or hidden.
adStarted An ad has started playing.
adCompleted An ad has finished playing.
adClicked An ad has been clicked on. The event is only fired for VAST ads, Google AFV, DoubleClick, and YuMe.
apiReady The player is ready to receive API requests like playMovie(), getItem(), etc. Wait for this event to be dispatched before making any API requests.
currentItemEmbedCodeChanged The embedCode of the active video has changed.
embedCodeChanged Change of the player's embed code.
fullscreenChanged Full-screen state has been toggled.

The player has completed loading. This is deprecated; please use the apiReady event instead.

metadataReady The metadata requested by the fetchMetadata() call is now ready.
playComplete The video or channel has completed playing.
playheadTimeChanged Update of active video play time.

The ratings API has loaded and is now ready for use.

relatedMediaReady The relatedMedia requested by the fetchRelatedMedia() call is now ready.
seeked A seek event happened in the player.
stateChanged Player state shift between playing, paused, buffering, or error.
totalTimeChanged Change of the play length of the current video.
volumeChanged( ) The volume of the player has been changed.

ActionScript Bitrate Selection API

The Bitrate Selection API allows developers to programmatically obtain current buffer size, as well as get and set bitrates. In order to select a bitrate, we offer 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 lists and describes the bitrate selection functions/methods.
Bitrate Selection Function Name Description
bufferLength() Returns the current size of the buffer in seconds, when buffer length is supported, or 0 otherwise.
bitrateQualitiesAvailable() Returns an array of strings.
bitratesAvailable Returns an array with the total number of bitrates, in kbps, or an empty array when the number of encodings is not available.
targetBitrateQuality(quality) Set the target bitrate quality.
targetBitrateQuality() Get the target bitrate quality. One of auto, low, medium or high.
targetBitrate(bitrate) Set the target bitrate, in kbps.
targetBitrate() Get the target bitrate, in kbps, when target bitrate was previously set, or -1 otherwise.

ActionScript Bitrate Selection Events

The following table lists and describes the Ooyala Player bitrate selection events
Bitrate Selection Events Description
targetBitrateQualityChanged The target bitrate quality has changed.
targetBitrateChanged The target bitrate has changed.

ActionScript Examples

The following lists the available query string pass-through parameter examples. Click the link to see the example.