Methods

The following methods can be called on the player API object.

on( eventType , handler )

Attach an event handler method on events thrown by the player, in the same way as jQuery's .on() does.

Arguments

Key Type Value
eventType string One or more space-separated event types and optional namespaces.
handler function A method to execute when the event is triggered.

Note: As noted in the jQuery documentation, it is possible to add a namespace to eventType, and we encourage you to do so. This will prevent accidental detaching of event handlers by other applications using the same player API.

off( eventType )

Detach an event handler method from events thrown by the player. Please refer to the jQuery documentation for more information.

Arguments

Key Type Value
eventType string One or more space-separated event types and optional namespaces.

load( params )

Load a clip.

Arguments

Object params

Key Type Value
type string ‘LoadParams’
clipId number Clip ID from the VMS
cliplistId number Cliplist ID from the VMS
xmlUrl string URL to a valid XML URL
seekTo number On what time the player should start playing (in seconds)
autoPlay boolean If the player should autoplay when loaded
token string Pass a (session) token to the loaded clip
useSession boolean If the player should use the browser session to load new clips

play( userAction )

Play the loaded video.

Arguments

Key Type Value
userAction boolean true if called in response to a user action (optional)

Returns

Type Value
boolean Returns true on success, false on failure.

pause()

Pause the video.

Returns

Type Value
boolean Returns true on success, false on failure.

seek( positionInSeconds )

Seek the video.

Arguments

Key Type Value
positionInSeconds number The time to seek to in seconds.

Returns

Type Value
boolean Returns true on success, false on failure.

setVolume( volume )

Set the master volume (including timeline Picture in picture widgets).

Arguments

Key Type Value
volume number A number between 0 and 1.

Returns

Type Value
boolean Returns true on success, false on failure.

setMuted( muted, reserved, userAction )

Set the master mute state (including timeline Picture in picture widgets).

Arguments

Key Type Value
muted boolean true to mute the player, false to unmute.
userAction boolean true if called in response to a user action (optional)

Returns

Type Value
boolean Returns true on success, false on failure.

setProgramVolume( volume )

Set the volume for the main video.

Arguments

Key Type Value
volume number A number between 0 and 1.

Returns

Type Value
boolean Returns true on success, false on failure.

setProgramMuted( muted )

Set the muted state for the main video.

Arguments

Key Type Value
muted boolean true to mute the player, false to unmute.

Returns

Type Value
boolean Returns true on success, false on failure.

setAsset( assetId )

Switch the asset for the current video.

Arguments

Key Type Value
assetId number An asset ID matching one from playerAPI.getAssets().

Returns

Type Value
boolean Returns true on success, false on failure.

setFitMode( fitMode )

Change the way video is fitted inside the player.

Arguments

Key Type Value
fitMode string FIT_SMART,FIT_BOTH,FIT_OVERSCAN,FIT_NATIVE,FIT_STRETCH,FIT_SMART,FIT_VERTICAL,FIT_HORIZONTAL

Returns

Type Value
boolean Returns true on success, false on failure.

setLocalStorageItem( key, value )

Change an entry in LocalStorage, if permitted by cookie settings

Arguments

Name Type Value
key string
value string

Returns

Type Value
boolean Returns true on success, false on failure.

fullscreen()

Enter fullscreen mode.

retractFullscreen()

Exit fullscreen mode.

toggleFullscreen()

Enters fullscreen mode when the player is not fullscreen, and exits fullscreen mode when the player is fullscreen.

increaseSizerRate()

A 100% width and height player automaticly resizes to the parent element, but needs to manually poll the size of the parent element. To achieve a smoother animation when resizing the parent element, this method can be called before the animation.

Note: This is not required when the player gets resized due to a window resize.

decreaseSizerRate()

Decrease the rate of the sizer described above. Decreasing the rate improves the overall performance of Javascript on the page.

getWrapper()

Returns the player wrapper DOM element.

Returns

Type Value
element object The wrapper DOM element.

getDetections()

Please refer to the detections documentation for available commands and variables.

getContentLayer()

Returns the content layer. This can be usefull when you want to resize the content (video + timeline + subtitles) inside the player to show a description or related clips.

Returns

Type Value
element object The wrapper DOM element.

getSkinLayer()

Get the skin layer. This can be usefull to find HTML DOM elements.

Returns

Type Value
element object The skin container DOM element.

getSubtitleLayer()

Returns the subtitle layer. This can be usefull when custom subtitles are implemented in the skin.

Returns

Type Value
element object The subtitle container DOM element.

getPhase()

Returns the current phase of the player.

Returns

Type Value
string One of the following phases: INIT, PRE, MAIN, POST, EXIT.

getMode()

Returns the current mode of the player. The following modes are possible:

Returns

Type Value
string One of the following modes: static, commercial, audio, video, presentation, live-audio, live-video, live-presentation.

getCurrentTime()

Returns the current time of the main clip.

Returns

Type Value
number The current time in seconds.

getBuffered()

Returns the buffered parts of the main clip. Different parts of the video can be buffered as a result of seeking.

Returns

object TimeRanges

Key Type Value
start array Contains all start points in seconds.
end array Contains all end points in seconds.
length number Specifies the number of buffered parts.

Example

  1. var buffered = playerAPI.getBuffered();
  2. // Loop through all the buffered parts
  3. for (i=0; i < buffered.length; i++) {
  4.         var start = buffered.start[i];
  5.         var end = buffered.end[i];
  6. }

getDuration()

Returns the duration of the main clip.

Returns

Type Value
number The duration of the main clip in seconds. Returns null for static clips.

getVolume()

Returns the current master volume. This method can be used when the volumechange event is fired to get the current player volume.

Returns

Type Value
number The master volume between 0 and 1.

Example

Get the volume after a volume change.

  1. playerAPI.on('volumechange', onVolumeChange);
  2. playerAPI.setVolume(0.5);
  3.  
  4. function onVolumeChange(ev){
  5.         var volume = playerAPI.getVolume();
  6. }

getMuted()

Returns the current master muted state.

Returns

Type Value
boolean true for muted, false for unmuted.

getLogo()

Returns the logo of the active playout.

Returns

object

Key Type Value
position string The desired position of the logo (eg. TOPRIGHT).
url string The URL where the logo should link to.
src string The URL of the logo image.
id number The ID of the clip used as logo.

getThumbnail( clipId [, width] [, height] )

Returns a URL to the thumbnail for the specified clip with specified dimensions.

Arguments

Key Type Value
clipId number A clip ID.
width number The desired width of the thumbnail in pixels. Defaults to the original width.
height number The desired height of the thumbnail in pixels. Defaults to the original height.

Returns

Type Value
string Returns the URL of the thumbnail.

isPlaying()

Returns the playing state of the player.

Returns

Type Value
boolean Returns true if the player is not playing, otherwise returns false.

isFullscreen()

Returns the fullscreen state of the player.

Returns

Type Value
boolean Returns true if the player is fullscreen, otherwise returns false.

getAssets()

Returns an array containing (multiple) asset objects which can be used on the current device.

Returns

Type Value
array Returns an array of objects containing asset data, please refer to getCurrentAsset().

getCurrentAsset()

Returns an object containing information about the currently used asset.

Returns

object Asset

Key Type Value
id number The asset ID.
mediatype string The mediatype of the asset, eg. MP4_MAIN or MP4_IPOD.
title string The title that can be used as label for a button.
bitrate number The desired position of the logo (eg. TOPRIGHT).
classes string A string containing classes which can be applied on a button for this asset.
width number The width of the asset.
height number The height of the asset.

getSubtitlesList()

Returns an array containing (multiple) subtitle objects related to the current clip.

Returns

Type Value
array Returns an array of objects containing subttile data, please refer to getCurrentSubtitle().

getCurrentSubtitle()

Returns an object containing information about the currently used subtitle.

Returns

object Subtitle

Key Type Value
id number The ID of the subtitle.
languageid number The language ID of the subtitle.
name string The name of the subtitle (eg. Dutch or German).
languagename string The translated name of the subtitle (eg. Nederlands or Deutsch).
default boolean true if this is the default selected subtitle, false otherwise.
isocode string The ISO 639-1 code of the language of the subtitle.
status string The status of the subtitle (published or draft).
parsedData array An array containing all subtitle lines.

getCurrentSubtitleLine()

Returns the active subtitle line.

Returns

Type Value
string The current (HTML formatted) subtitle line.

setSubtitle( subtitleId )

Sets the subtitle.

Arguments

Key Type Value
subtitleId number The subtitle ID (found in the Subtitle object retreived from getSubtitlesList).

getClipData() - TODO

Returns all the data for the current clip. Please refer to the actual Player API to view the returned contents, this can be done with the following lines of Javascript and the Firefox / Chrome Developer Console:

  1. console.log(playerAPI.getClipData());

NOTE: Please be advised that the returned object is subject to change, and thus we suggest to check all variables inside the object before using them.

  1. if(typeof clipdata.title != 'undefined'){
  2.         setTitle(clipdata.title);
  3. }

getProjectData()

Returns all the project meta data. The operation of this method is similar to the getClipData() method, but returns a different set of data.

getPlayoutData()

Returns all the playout settings from the VMS. The operation of this method is similar to the getClipData() method, but returns a different set of data.

getRelatedClips()

Returns an array of clip objects related to the active clip.

Note: This method only returns data when the relatedclipschange has been fired by the player.

getChapterList()

Returns an array of chapter objects set for the current clip in the Timeline.

Returns

object chapter

Key Type Value
id number The ID of the chapter.
title string The title of the chapter as set in the VMS Timeline editor.
description string The description of the chapter as set in the VMS Timeline editor.
timeOffset number The time on which the chapter is set in seconds.

getSharing()

Returns an array with objects containing social sharing details.

Returns

object share

Key Type Value
id number The ID of the chapter.
name string A machine readable name for the share item.
title string A human readable name for the share item.
url number A formatted URL which directs to a share page of the social network.

getDeeplink()

Returns the deeplink of the current clip as specified in the VMS.

Returns

Type Value
url The formatted deeplink URL matching the settings specified in the VMS.

getEmbedcode( [width] [, height] )

Returns the embedcode with an optionally specified widht and height to override the playout width and height.

Arguments

Key Type Value
width number The width in pixels of the player embedded with the returned embedcode.
height number The height in pixels of the player embedded with the returned embedcode.

Returns

Type Value
string A formatted embedcode that can be used to embed the player.

getPropertyValue - Undocumented?

getLocalStorageItem( key )

Returns the value of LocalStorage entry key.

Arguments

Name Type Value
key string The storage key

Returns

Type Value
mixed The stored value, if any

showInterfaceElement( elementName )

Shows the specified element. Available elements are:

  • controlBar
  • playPauseButton
  • progressBar
  • timeDisplay
  • muteButton
  • volumeSlider
  • languageButton
  • hdButton
  • fullscreenButton
  • shareButton

Arguments

Key Type Value
elementName string A valid element name.

hideInterfaceElement( elementName )

Hides the specified element.

Arguments

Key Type Value
elementName string A valid element name. Please refer to showInterfaceElement.

enableInterfaceElement( elementName )

Enables the specified element.

Arguments

Key Type Value
elementName string A valid element name. Please refer to showInterfaceElement.

disableInterfaceElement( elementName )

Disables the specified element.

Arguments

Key Type Value
elementName string A valid element name. Please refer to showInterfaceElement.

destruct()

Destructs the player, freeing up memory and removing its elements from the DOM