Embed Code ActionScript APIs (Player V2 Deprecated)

Embed Code ActionScript APIs can be used to handle getting and setting the embedCode for assets, getting asset descriptions, getting images and fetching asset metadata.

EmbedCode Properties

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.

The following table describes all the JavaScript properties that are associated with embed code.

Function Description
getCurrentItemEmbedCode

Get the embedCode for the current video in a channel.

Type: String

Return Value: returns the embed code information.

getEmbedCode Get the embedCode for the current player.

Type: String

Return Value: returns the embed code information.

Example: "Q3bDhiMToizUftO"

getItem Get an Object describing the embedded item. The Object includes embedCode, title, description, time (play length in seconds), lineup, promo, and hostedAtURL.

Type: Object

Return Value: Item description

setCurrentItemEmbedCode Set the embedCode for the current video in a channel.

Type: String

setEmbedCode Set the embedCode for the current player

Type: String

EmbedCode Functions

The following table describes all the JavaScript functions that are associated with the embed code.

Event Description
changeCurrentItem(embedCode)

Set the current video in a channel if the video is present. Returns true if accepted, false if not.

Type: Boolean

Return Value: true | false

currentItemEmbedCodeChanged() description, embedCode, hostedAtURL, lineup, promo, time (in seconds), title.

Type: Hash

embedCodeChanged()

description, embedCode, hostedAtURL, lineup, promo.

Type: Hash

fetchMetadata(embedCode)

Begins fetching the custom metadata for the given embedCode. When the metadata is fetched, the metadataReady event will be fired, which contains all of the asset's name/value pairs. This API is available to Professional and Enterprise accounts.

Type: String

Return Values: name/value pairs

fetchRelatedMedia(embedCode, options)

Begins fetching the related media for the given embedCode. When the related media is fetched, the relatedMediaReady event will be fired, which contains related media for the asset. Related media is specified in Backlot under the Publish->Player Branding->End Screen tab. The options parameter is an optional Object parameter. It can have the following fields:

  • orderBy:
  • uploadedAt,DESC
  • uploadedAt,ASC

Example: To fetch related media for theEmbedCode with the newest video first:

 fetchRelatedMedia("theEmbedCode", { orderBy: "uploadedAt,DESC" })
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.

Type: String

Return Values: URL | null

Related Information

The following list provides links to Backlot documentation that provides some general information about embed codes and embed code snippets.

Was this article helpful?