new Player()
Methods
-
<static> create(elementId, embedCode, parameters) → {Object}
-
Creates a player object and attaches it to the specified element. This is an asynchronous method and will return before the player is completely initialized. Listen for the
PLAYBACK_READYevent to determine whether the player is completely initialized.Compatibility:
HTML5, Flash
Parameters:
Name Type Description elementIdNumber The ID of the element to which to attach the player object. embedCodeNumber The embed code. The player will load the embed code video. Only a single video is supported. parametersObject The player parameters. These can be used to customize player ads and behavior, and can determine player styles. For more information, see Embedded Parameters. Returns:
The created player object.- Type
- Object
-
destroy(callback)
-
Destroys the item. When this method is called, the player is removed, all activity is stopped, and any video is unloaded. This is an asynchronous method and may return before having completed the operation. If your logic depends on the completion of this operation, listen to the corresponding event.
Compatibility:
HTML5, Flash
Parameters:
Name Type Description callbackfunction (Optional) A function callback used to notify a web page that the destroymethod has completed destroying the HTML5 player. -
getBitrateInfo() → {Array}
-
Retrieves all bitrate information, including bitrates, bitrate qualities, target bitrates, and target bitrate qualities.
For more information see Video Bit Rate.
Compatibility:
Flash
- See:
-
- getBitratesAvailable
- getBitrateQualitiesAvailable
- getTargetBitrate
- getTargetBitrateQuality
- setTargetBitrate
- setTargetBitrateQuality
Returns:
An array containing all bitrate information, including bitrates, bitrate qualities, target bitrates, and target bitrate qualities. You can retrieve information from the array using the following indexes (assumebitrateInfois the returned object:bitrateInfo['bitrates']bitrateInfo['bitrateQualities']bitratesInfo['targetBitrate']bitrateInfo['targetBitrateQuality']
- Type
- Array
-
getBitrateQualitiesAvailable() → {Array}
-
Retrieves the bitrate quality encodings that are available.
For more information see Video Bit Rate.
Compatibility:
Flash
- See:
-
- getBitratesAvailable
- getBitrateInfo
- getTargetBitrate
- getTargetBitrateQuality
- setTargetBitrate
- setTargetBitrateQuality
Returns:
An array of strings. The length of the array depends on the available encodings:- 1 encoding available: returns
['auto'] - 2 encodings available: returns
['auto','low','high'] - 3 or more encodings available: returns
['auto','low','medium','high'] - No bitrate quality information available: returns
['auto']
- Type
- Array
-
getBitratesAvailable() → {Array}
-
Retrieves an array with the total number of bitrates, in kbps, or an empty array when the number of encodings is not available.
For more information see Video Bit Rate.
NOTE: With a Flash player you can retrieve the target bit rate, if you do so immediately. However, this is not true for Quicktime, which does not permit you to control its ability to retrieve the bitrate. The default with Quicktime is to use the suggested time on a best effort basis.
Compatibility:
Flash
- See:
-
- getBitrateInfo
- getBitrateQualitiesAvailable
- getTargetBitrate
- getTargetBitrateQuality
- setTargetBitrate
- setTargetBitrateQuality
Returns:
An array with the total number of bitrates, in kbps, or an empty array when the number of encodings is not available. For example,[250, 500, 1000]indicates that three bitrates are available: 250 kbps, 500 kbps and 1000 kbps. For a Flash-based Ooyala Player, you can use this API to get a list of available bitrates for use with thesetTargetBitrate()API.- Type
- Array
-
getBufferLength() → {Number}
-
Retrieves the current size of the buffer in seconds.
Compatibility:
HTML5, Flash
Returns:
The current size of the buffer in seconds when buffer length is supported; returns 0 otherwise.- Type
- Number
-
getCurrentItem() → {Object}
-
Retrieves an object describing the current video.
Compatibility:
HTML5, Flash
Returns:
The current video, described in an object containing the following attributes:embedCodetitledescriptiontime(play length in seconds)lineuppromohostedAtURL
- Type
- Object
-
getCurrentItemClosedCaptionsLanguages() → {Array}
-
Retrieves a list of supported closed captions languages for the currently playing item. This list is derived from the closed captions XML (DFXP [now TTML]) file for this content, uploaded via Backlot. For more information about this file see Uploading and Viewing a Closed Captions File. If there is no DFXP (now TTML) file in place, this method returns an empty list. In live streaming mode, the closed caption languages are derived from the stream itself.
Compatibility:
Flash
Returns:
A list of supported closed captions languages for the currently playing item.- Type
- Array
-
getCurrentItemDescription() → {String}
-
Retrieves the description of the current video. This function retrieves the description that was set in the the Backlot Manage Details tab or the equivalent manual setting.
Compatibility:
HTML5, Flash
Returns:
The description of the current video. For example,Season 22 Opening Game.- Type
- String
-
getCurrentItemEmbedCode() → {String}
-
Retrieves the embed code for the current player.
Compatibility:
HTML5, Flash
Returns:
The embed code for the current player.- Type
- String
-
getCurrentItemTitle() → {String}
-
Retrieves the title of the current video.
Compatibility:
HTML5, Flash
Returns:
The title of the current video. For example,My Snowboarding Channel.- Type
- String
-
getErrorCode() → {String}
-
Retrieves the current error code if it exists.
Compatibility:
HTML5, Flash
Returns:
The error code, if it exists.- Type
- String
-
getErrorText() → {String}
-
Retrieves a string corresponding to the current error code.
Compatibility:
HTML5, Flash
Returns:
The error code message. For example,This video is not authorized for this domain. Please contact the administrator.- Type
- String
-
getFullscreen() → {Boolean}
-
Determines whether the player is in full screen mode.
Compatibility:
HTML5, Flash
Returns:
trueif the player is in full screen mode,falseotherwise.- Type
- Boolean
-
getPlayheadTime() → {Number}
-
Retrieves the playhead position in seconds.
Compatibility:
HTML5, Flash
Returns:
The playhead position, in seconds.- Type
- Number
-
getState() → {String}
-
Retrieves the current player state. See OO.STATE for descriptions of the states.
Compatibility:
HTML5, Flash
Returns:
One of the following values:LOADINGREADYPLAYINGPAUSEDBUFFERINGERRORDESTROYED
- Type
- String
-
getTargetBitrate() → {Number}
-
Retrieves the target bitrate, in kpbs, if it was previously set.
For more information see Video Bit Rate.
Compatibility:
Flash
- See:
-
- getBitratesAvailable
- getBitrateQualitiesAvailable
- getBitrateInfo
- getTargetBitrateQuality
- setTargetBitrate
- setTargetBitrateQuality
Returns:
The target bitrate, in kpbs, or-1if it was not previously set.- Type
- Number
-
getTargetBitrateQuality() → {String}
-
- See:
-
- getBitratesAvailable
- getBitrateQualitiesAvailable
- getTargetBitrate
- getBitrateInfo
- setTargetBitrate
- setTargetBitrateQuality
Returns:
The target bitrate quality, which may be one of the following values:'auto''low''medium''high'
- Type
- String
-
getTotalTime() → {Number}
-
Retrieves the total duration, in milliseconds, of the video.
Compatibility:
HTML5, Flash
Returns:
The total duration of the video in milliseconds.- Type
- Number
-
getVolume() → {Number}
-
Retrieves the current volume on a best-effort basis according to underlying device limitations.
Compatibility:
HTML5, Flash
Returns:
The volume, whose value is between 0 and 1, inclusive.- Type
- Number
-
isolate(targetPlayer)
-
Isolates the specified player for debugging.
debug.ooyala.comautomatically generates a valid V3 embedded player. When you call this on a player it automatically generates the correspondingdebug.ooyala.comtest page.Compatibility:
HTML5, Flash
Parameters:
Name Type Description targetPlayerString The name of the divcontainer in which to load the player.Returns:
url The link to the isolated player. -
pause()
-
Pauses the current video playback. This is an asynchronous method and may return before having completed the operation. If your logic depends on the completion of this operation, listen to the corresponding event.
Compatibility:
HTML5, Flash
-
pauseMovie()
-
Pauses the current video playback. This is an asynchronous method and may return before having completed the operation. If your logic depends on the completion of this operation, listen to the corresponding event.
Compatibility:
HTML5, Flash
-
play()
-
Plays the current video and the entire asset including ads, or queues it for playback if the video is not ready. This is an asynchronous method and may return before having completed the operation. If your logic depends on the completion of this operation, listen to the corresponding event.
Compatibility:
HTML5, Flash
-
playMovie()
-
Plays the current video and the entire asset including ads, or queues it for playback if the video is not ready. This is an asynchronous method and may return before having completed the operation. If your logic depends on the completion of this operation, listen to the corresponding event.
Compatibility:
HTML5, Flash
-
seek(seconds)
-
Seeks to the specified number of seconds from the beginning. This is an asynchronous method and may return before having completed the operation. If your logic depends on the completion of this operation, listen to the
BUFFEREDevent.Compatibility:
HTML5, Flash
Parameters:
Name Type Description secondsNumber The number of seconds from the beginning at which to begin playing the video. -
setClosedCaptionsLanguage(language)
-
Sets the language of the closed captions (CC) that will be shown in the player. If you do not upload the Closed Captions file, the content will play back without closed captions. In Live streaming mode, the closed caption languages are derived from the stream itself. Note that because of the way that closed captions are supported in iOS, we are not able to add closed caption data for IOS web for remote assets.
NOTE: Because of the way that closed captions are supported in iOS, closed caption data cannot be added for IOS web for remote assets.
Compatibility:
Flash
Parameters:
Name Type Description languageString Specify the ISO 639-1 language code. For example, specify "en","de", or"ja"for English, German, or Japanese. Use"zh-hans"for Simplified Chinese and"zh-hant"for Traditional Chinese. To show no closed captions, set the language to"none". -
setCurrentItemEmbedCode(embedCode, options)
-
Sets the embed code for the current player. You may optionally specify an
optionsobject that enables you to dynamically assign an ad set or other asset-level options to the embed code. For example, you can set the initial position from which the player will start. This is an asynchronous method and may return before having completed the operation. If your logic depends on the completion of this operation, listen to the corresponding event.Compatibility:
HTML5, Flash
Parameters:
Name Type Description embedCodeString An embed code belonging to the same provider as the ad set code. optionsObject (Optional) An object containing a hash of key-value pairs representing the unique ad set code. -
setEmbedCode(embedCode, options)
-
Sets the embed code for the current player. You may optionally specify an
optionsobject that enables you to dynamically assign an ad set or other asset-level options to the embed code. For example, you can set the initial position from which the player will start. This is an asynchronous method and may return before having completed the operation. If your logic depends on the completion of this operation, listen to the corresponding event.Compatibility:
HTML5, Flash
Parameters:
Name Type Description embedCodeString An embed code belonging to the same provider as the ad set code. optionsObject (Optional) An object containing a hash of key-value pairs representing the unique ad set code. -
setPlayheadTime(seconds)
-
Seeks to the specified number of seconds from the beginning. This is an asynchronous method and may return before having completed the operation. If your logic depends on the completion of this operation, listen to the
BUFFEREDevent.Compatibility:
HTML5, Flash
Parameters:
Name Type Description secondsNumber The number of seconds from the beginning at which to begin playing the video. -
setTargetBitrate(bitrate)
-
Sets the target bitrate, in kbps. You must specify an available bitrate. To determine which bitrates are available, call
getBitratesAvailable(). In OSMF, the target bitrate is adjusted to the nearest matching lower available bitrate. Then the player attempts to change the bitrate to that value for the upcoming chunk. In other modules the adjustment happens on usage when retrieving the upcoming chunk.
NOTE: This setting does not carry over from video to video. For example, consider a channel with two videos, the first havin its highest bitrate of 1000 kpbs, and the second having a medium bitrate of 1000 kpbs and a highest bitrate of 2000 kpbs. If you set the bitrate to 1000 kpbs, this number is converted to a bitrate quality (high in this example). Since the bitrate quality carries over, the first video will play at 1000 kpbs, and the second video will play at 2000 kpbs, which is its highest bitrate.
For more information see Video Bit Rate.
This is an asynchronous method and may return before having completed the operation. If your logic depends on the completion of this operation, listen to the corresponding event.Compatibility:
Flash
Parameters:
Name Type Description bitrateNumber The target bitrate, in kbps. - See:
-
- getBitratesAvailable
- getBitrateQualitiesAvailable
- getTargetBitrate
- getTargetBitrateQuality
- getBitrateInfo
- setTargetBitrateQuality
-
setTargetBitrateQuality(bitrateQuality)
-
Sets the target bitrate quality.
For more information see Video Bit Rate.
This is an asynchronous method and may return before having completed the operation. If your logic depends on the completion of this operation, listen to the corresponding event.Compatibility:
Flash
Parameters:
Name Type Description bitrateQualityString Specify one of the following values: 'auto''low''medium''high'
- See:
-
- getBitratesAvailable
- getBitrateQualitiesAvailable
- getTargetBitrate
- getTargetBitrateQuality
- setTargetBitrate
- getBitrateInfo
-
setVolume(volume)
-
Sets the current volume on a best-effort basis according to the underlying device limitations. This is an asynchronous method and may return before having completed the operation. If your logic depends on the completion of this operation, listen to the corresponding event.
Compatibility:
HTML5, Flash
Parameters:
Name Type Description volumeNumber The volume. Specify a value between 0 and 1, inclusive. -
shouldDisplayCuePointMarkers(visible)
-
When called while a player is playing, this Boolean function shows or hides cue point markers on the scrubber bar during ad playback.
By default, cue point markers are hidden. IfshouldDisplayCuePointMarkers(True)is called and there are active mid-roll and post-roll ads available, the player displays any cue point markers on the scrubber bar. This is an asynchronous method and may return before having completed the operation. If your logic depends on the completion of this operation, listen to the corresponding event.Compatibility:
Flash
Parameters:
Name Type Description visibleBoolean Set to trueto show cue point markers on the scrubber bar during ad playback; set tofalseotherwise. The default isfalse. -
subscribe(eventName, subscriber, callback)
-
Subscribe to a specified event.
Compatibility:
HTML5, Flash
Parameters:
Name Type Description eventNameString The name of the event. subscriberString The name of the subscriber to which the message bus will publish the event. callbackfunction The function that will execute when the subscriber receives the event notification. -
toggleInfoPanel()
-
Toggles the visibility of the info screen. This is an asynchronous method and may return before having completed the operation. If your logic depends on the completion of this operation, listen to the corresponding event.
Compatibility:
Flash
-
toggleSharePanel()
-
Toggles the visibility of the player share screen. This is an asynchronous method and may return before having completed the operation. If your logic depends on the completion of this operation, listen to the corresponding event.
Compatibility:
Flash