Player API Documentation


Enables sites using the IBM Video Streaming embed iframe to build and adapt on the embed live player.

The Player API provides basic methods to control the live stream or recorded video playback, and enables the user to access essential events of the live stream or the played video.

The Player API requires postMessage DOM API, it won't work in browsers that does not support the postMessage API.


First, a valid IBM Cloud Video embed iframe will be needed to use the Embed API. Log in to your managed IBM Cloud Video account as an administrator of your channel. Then navigate to the Embed Configurator page on your Dashboard by selecting the "Embed" option as seen below:

Embed configurator page location in channel menu

After selecting an option with the IBM Cloud Video Player, the Embed Configurator is displayed. The Configurator enables channel administrators to set the properties of the Player embed. When it's done, the proper iframe HTML element can be copied to the clipboard with the button which is highlighted in the next picture.

Embed configurator Copy to clipboard button location

The next step is to include a unique ID in this iframe element. We will use "UstreamIframe".

Create an instance of the Embed API by providing the ID of the iframe. The iframe code should look like this:

<iframe id="UstreamIframe" src="" width="640" height="480" allowfullscreen webkitallowfullscreen></iframe>
var viewer = UstreamEmbed('UstreamIframe');

URL parameters

The default behaviour of the player can be modified by extending the src URL with any of the following parameters:

Parameter Effect Values Default
allowfullscreen Disables fullscreen and remove the button. true/false true
autoplay Starts video playback automatically. true/false false
controls When set to false it hides all UI elements. true/false true
hideCTA Disables CTA overlays. Use liveCtaUpdate event to build your own. true/false false
offaircontent Disables displaying offair content. true/false true
forced-quality Overrides the automatic quality selection. low, med, high auto
initial-quality Sets the initial quality for the automatic quality selection. low, med, high auto
showtitle Hides title and viewer count. true/false true
volume Overrides the default volume. 0 is mute, 1 is max volume. 0.0-1.0 user setting


Calls a command method of the embed player, passing in any arguments.
Available commands through callMethod:


Starts playing the currently loaded channel or video.



Pauses the live stream, or the playback of a video.



Pauses the live stream, or stops the video and jumps back to the start.



Loads a channel or a video in the player. Requires two additional arguments:

  • type - the loaded content type (channel | video)
  • id - the loaded content id
viewer.callMethod('load', 'video', 5903947);
viewer.callMethod('load', 'channel', 1524);


Jumps to given position in played recorded video. Requires one argument:

  • position in seconds
viewer.callMethod('seek', 180);


Sets the playback sound volume. Requires one argument:

  • volume percent between 0-100
viewer.callMethod('volume', 0); //mute


Sets the stream quality, if available. Requires one argument:

  • a qualityID key from received quality options in quality event
viewer.callMethod('quality', 16); //set to high

cc (closed caption)

Enables the selected closed caption if available. Requires one argument:

  • a ccIndex key from the received closed caption array in cc event
viewer.callMethod('cc', 1); //enable the closed caption with index 1
viewer.callMethod('cc', -1); //disables the closed caption


Read a property of the embed player. This method is asynchronous, the data will be passed to a callback function, given as argument.

Accessible properties by getProperty:


Get the video duration in seconds.

viewer.getProperty('duration', function (duration) {


Get the current viewer count for the loaded live stream.

viewer.getProperty('viewers', function (viewerNumber) {


Get the current progress for recorded video playback, in seconds.

viewer.getProperty('progress', function (progress) {


Get the current content type and id as an array.

viewer.getProperty('content', function (content) {
    // content == ['channel', 1524]
    // or
    // content == ['recorded', 123456]


Get the actual content type and id as an array. This will return the currently played offair video's id if the loaded content is an offair channel or with the channel id if the channel is live.

viewer.callMethod('load', 'channel', 1524);

// ...

viewer.getProperty('playingContent', function (content) {
    // content == ['channel', 1524]
    //  - if it's live, or
    // content == ['recorded', 123456]
    //  - if it's offair and has offair video content, or
    // content == []
    //  - if it's offair and doesn't have offair video content

addListener & removeListener

The embed player dispatches several events during playback. This method adds or removes event handlers to these events.

The event handler callback receives two arguments:

  • type the type of the event
  • data optional data sent along the event

Available events for addListener and removeListener:


Called when the currently loaded offline channel becomes live.

viewer.addListener('live', callBack);


Called when the currently loaded live channel goes offline.

viewer.addListener('offline', callBack);


Called when the currently loaded and played recorded video reaches its end.

viewer.addListener('finished', callBack);


Called when the currently loaded content playback is started or stopped. Sends data along the event:

  • playing (boolean)
viewer.addListener('playing', callBack);


Called when the stream size is available, or changed (changes reported only in flash mode). Sent data is the size of the calculated embed iframe according to the player width, and the stream aspect ratio. The player bar height is included, if the controls are visible.

Sends data along the event:

  • size (array) as [width, height] in pixels
viewer.addListener('size', callBack);


Fired when the stream quality options are available.

Receives an object, with the qualityID as keys, and an object with two properties as values:

  • label (string) label to show to users on control UI, eg.: "480p"
  • active (booelan) if this quality is used or set
viewer.addListener('quality', callBack);
// example quality object

cc (closed caption)

Fired when there are closed captions available on the stream.

Returns an array containing closed captions as objects.

  • index (integer) unique index of the closed caption
  • label (string) label of the closed caption
  • language (string) language code of the closed caption (en, etc.)
  • active (booelan) if this closed caption is shown
viewer.addListener('cc', callBack);
// example cc object
	{"index":0, "label":"English", "language":"en", "active":false}


Called when a the player content changes for some reason. Same data as received in getProperty('content')

Received arguments: data (object)

viewer.addListener('content', callBack);


Fired when there is a live cta available on the stream.

Returns an object:

  • buttonText (string) text of the button
  • buttonUrl (string) URL of CTA
  • description (string) description of CTA
  • id (integer) id of CTA
  • imageUrl (string) URL of the image
  • title (string) title of CTA
viewer.addListener('liveCtaUpdate', callBack);
// example cta object when activated:
    activate: {
        buttonText: "Click here!"
        buttonUrl: ""
        description: "The Future of Video with Watson",
        id: 123,
        imageUrl: "URL of image",
        title: "IBM Video Streaming"
// example cta object when removed:
    remove: {
        id: 123