Module: Api

This page provides a reference to all the available JavaScript API calls.
These APIs can be used to enhance the functionality of your embeds, or to implement advanced page interactions.

To interact with the player, you have to initialize it first.
Once the Player has been initialized you can perform API calls.

Example

var options = {
		clientId: "your clientId here",
		xcontentId: "an xcontentId here",
		sessId: "pkey or session token"
	};
var player = THRONContentExperience("elementId", options);
//Now we have the instance: player
//Use "on" method:
player.on("ready", function(){console.log("Reproducer is ready");})

Methods


<static> mediaContainer()

  • Requires input parameters: no
  • Returns a value: yes
  • Available for: all content types

This method returns the HTML DOM element containing the object that will reproduce the content.
For example, in this container you will find as child the video HTML element or the audio HTML element.
This method is useful if you want to access the item that will play the content.
We strongly suggest to call this method after the Player's ready event (see example).

Returns:
Type
HTMLDivElement
Example
var options = {
		clientId: "your clientId here",
		xcontentId: "an xcontentId here",
		sessId: "pkey or session token"
	};
	var player = THRONContentExperience("elementId", p1);
	var onReadyFunction = function () {
		var mediaContainer = player.mediaContainer();
		var videoInstance = mediaContainer.querySelector("video");
		console.log("HTMLVideoElement", videoInstance);
		//Remove listener ready:
		player.off("ready", onReadyFunction);
	}
//Use "on" method:
player.on("ready", onReadyFunction);

<static> container()

  • Requires input parameters: no
  • Returns a value: yes
  • Available for: all content types
    This method returns the HTML DOM element which contains all the Player HTML components.
    This method is useful if you want to access all the Player html components and create an advanced customization.
    We strongly suggest to call this method after the Player's ready event (see example).
Returns:
Type
HTMLDivElement
Example
var options = {
		clientId: "your clientId here",
		xcontentId: "an xcontentId here",
		sessId: "pkey or session token"
	};
	var player = THRONContentExperience("elementId", p1);
	var onReadyFunction = function () {
		var container = player.container();
		console.log("HTMLElement", container);
		//Remove listener ready:
		player.off("ready", onReadyFunction);
	}
//Use "on" method:
player.on("ready", onReadyFunction);

<static> playToggle()

  • Requires input parameters: no
  • Returns a value: no
  • Available for: Audio, Audio playlist, Video, Video playlist

This method is useful to switch the playback status of the content: if the content is playing it will be paused and vice versa.


<static> play()

  • Requires input parameters: no
  • Returns a value: no
  • Available for: Audio, Audio playlist, Video, Video playlist

This method is useful to play the content.
If content is already playing and this method is called, the content will keep playing.


<static> pause()

  • Requires input parameters: no
  • Returns a value: no
  • Available for: Audio, Audio playlist, Video, Video playlist

This method is useful to pause the content.
If content is already paused and this method is called, content will remain in pause.


<static> seek(position)

  • Requires input parameters: yes
  • Returns a value: no
  • Available for: Audio, Audio playlist, Video, Video playlist

This method is useful to move/skip to a new position in the content.
The seek method receives an input parameter equal to the number of seconds from which to start content playback.

Parameters:
Name Type Description
position Number

The position (in seconds) to seek to

Example
//Seek to seconds 10
var options = {
		clientId: "your clientId here",
		xcontentId: "an xcontentId here",
		sessId: "pkey or session token"
	};
var player = THRONContentExperience("elementId", p1);
//On Playing listener:
var onPlaying = function () {
		player.seek(10);
		//Remove listener playing:
		player.off("playing", onPlaying);
	};
	//Attach listener:
	player.on("playing", onPlaying);

	

<static> volume( [volume])

  • Requires input parameters: no, it's optional
  • Returns a value: yes
  • Available for: Audio, Audio playlist, Video, Video playlist

This method can be used to set or get the volume level.
Volume method receives an input parameter equal to the desired volume level (from 0 to 1).
If not provided, the method will return the current volume level.

Parameters:
Name Type Argument Description
volume Number <optional>

Set the volume of the player between 0-1

Returns:

The current volume value

Type
Number
Example
//Set volume to 0
var options = {
		clientId: "your clientId here",
		xcontentId: "an xcontentId here",
		sessId: "pkey or session token"
	};
var player = THRONContentExperience("elementId", p1);
//On Playing listener:
var onPlaying = function () {
		player.volume(0);
		//Print volume:
		console.log(player.volume());
		//Remove listener playing:
		player.off("playing", onPlaying);
	};
	//Attach listener:
	player.on("playing", onPlaying);

<static> status()

  • Requires input parameters: no
  • Returns a value: yes
  • Available for: Audio, Audio playlist, Video, Video playlist

This method returns content playback information.

Returns:
  • For video and video playlist the method returns the following informations: canSeek (boolean, if true the content can be seeked), currentTime (number of played seconds), duration (total number of seconds), muted (boolean, if true the current volume level is 0), playing (boolean, if true the content is currently playing), volume (number, current volume level).
  • For audio and audio playlist the method returns: playing, currentTime, duration.
  • For document the method returns: pages, actualPage
Type
Object

<static> qualityLevels()

  • Requires input parameters: no
  • Returns a value: yes
  • Available for: Video, Video playlist

This method returns a list of information about quality levels of video elements.

Returns:

It returns an array of items, each representing a quality level with the following information:

  • bitrate, kbps;
  • index, the index of each quality level. Can be used to switch quality using the currentQuality method. If the content is being reproduced in streaming, the -1 index represents the adaptive quality level;
  • label, the display name of each quality level;
  • url, the url of each quality level.
Type
Array
Example
//Get video list of video quality
var options = {
		clientId: "your clientId here",
		xcontentId: "an xcontentId here",
		sessId: "pkey or session token"
	};
var player = THRONContentExperience("elementId", p1);
//When quality levels are loaded:
var onLevelsReady = function () {
		//Print levels list
		console.log(player.qualityLevels());
		//Remove listener levels:
		player.off("levels", onLevelsReady);
};
player.on("levels", onLevelsReady);

<static> currentQuality( [index])

  • Requires input parameters: no, is optional
  • Returns a value: yes
  • Available for: Video, Video playlist

This method can be used to set or get the quality level of the video.

Parameters:
Name Type Argument Description
index Number <optional>

It sets video quality to a specified index. You can find the correct index
calling qualityLevels method, taking any object of the returned array (see the example).

Returns:

It returns the index of the current active quality level

Type
Number
Example
var onPlaying = function () {
		var qualities = player.qualityLevels();
		if(qualities.length > 0){
			var lowestQuality = qualities[0].index;
			player.currentQuality(lowestQuality);
		 	console.log( player.currentQuality());
		}
		//Remove listener playing:
		player.off("playing", onPlaying);
	};
	player.on("playing", onPlaying);

<static> audioTracks()

  • Requires input parameters: no
  • Returns a value: yes
  • Available for: Live

This method returns a list of available audio tracks.

Returns:

It returns an array of items, each representing an audio track

Type
Array

<static> currentAudioTrack(id)

  • Requires input parameters: no, is optional
  • Returns a value: yes
  • Available for: Live

This method can be used to set or get the current audio track.

Parameters:
Name Type Description
id Number

It sets audio track to a specified track id. You can find the track id
calling audioTracks method and taking it from objects returned.

Returns:

It returns the id of the current active audio track

Type
Number

<static> speed( [speed])

  • Requires input parameters: no, is optional
  • Returns a value: yes
  • Available for: Video, Video playlist

This method can be used to set or get the playback speed.
The speed method receives an input parameter equal to the desired playback speed. If not provided it returns the current playback speed.
Playback speed values are: 0.5, 0.75, 1, 1.25, 1.5, 2.

Parameters:
Name Type Argument Description
speed Number <optional>

Valid values are: 0.5, 0.75, 1, 1.25, 1.5, 2
calling qualityLevels method, taking any object of the returned array. From this object take the value of the index attribute (see the example)

Returns:

Returns the playback speed

Type
Number

<static> subtitles()

  • Requires input parameters: no
  • Returns a value: yes
  • Available for: Video, Video playlist

This method returns the list of available subtitles.

Returns:

It returns an array of items, each representing a subtitle file with the following information:

  • idx, the index of each subtitle file;
  • active, a boolean parameter which determines whether the subtitle file is active or not;
  • locale, the language of each subtitle;
  • url, the url of each subtitle file.
Type
Array

<static> currentSubtitle( [indexSubTitle])

  • Requires input parameters: no, optional
  • Returns a value: yes
  • Available for: Video, Video playlist

This method can be used to set or get the subtitle file.
The currentSubtitle method receives an input parameter equal to the index of the desired subtitle file.
If not provided it returns the index of the current active subtitle file.

Parameters:
Name Type Argument Description
indexSubTitle Number <optional>
Returns:

Returns the current subtitle index

Type
Number
Example
//Get the current subtitle:
var speed = player.currentSubtitle();
//Set the subtitle file with index=1:
player.currentSubtitle(1);

<static> disableSubtitle()

  • Requires input parameters: yes
  • Returns a value: no
  • Available for: Video, Video playlist
    This method can be used to enable or disable subtitles on stage.
    If set to true, subtitle will be hidden from the stage; if set to false, subtitle will be re-enabled on stage.

<static> zoomIn()

  • Requires input parameters: no
  • Returns a value: no
  • Available for: image, image playlists and document
    This method can be used to zoom in on an image or document content.
Example
var options = {
     clientId: "your clientId here",
	    xcontentId: "an xcontentId here",
		sessId: "pkey or session token"
};
var player = THRONContentExperience("elementId", options);
//Bind a button to this function:
var onZoomIn = function(){
     player.zoomIn();
};
//Bind a button to this function:
var onZoomOut = function(){
     player.zoomOut();
}

<static> zoomOut()

  • Requires input parameters: no
  • Returns a value: no
  • Available for: image, image playlists and document
    This method can be used to zoom out on an image or document content.

<static> zoomReset()

  • Requires input parameters: no
  • Returns a value: no
  • Available for: image, image playlists
    This method can be used to reset zoom level on an image content.
Example
var options = {
     clientId: "your clientId here",
	    xcontentId: "an xcontentId here",
		sessId: "pkey or session token"
};
var player = THRONContentExperience("xrrwt", options);
//Bind a button to this function:
var onZoomReset = function(){
     player.zoomReset();
};
//Bind a button to this function:
var onZoomIn = function(){
     player.zoomIn();
};
//Bind a button to this function:
var onZoomOut = function(){
     player.zoomOut();
}

<static> nextPage()

  • Requires input parameters: no
  • Returns a value: yes
  • Available for: document
    This method can be used to move to the next page of the document.
Returns:

Returns current page

Type
Number

<static> prevPage()

  • Requires input parameters: no
  • Returns a value: yes
  • Available for: document
    This method can be used to move to the previous page of the document.
Returns:

Returns current page

Type
Number

<static> goToPage(page)

  • Requires input parameters: yes
  • Returns a value: yes
  • Available for: document

This method can be used to move to a specific document's page.

Parameters:
Name Type Description
page Number

The page number to show

Returns:

Returns current page

Type
Number
Example
var options = {
     clientId: "your clientId here",
	    xcontentId: "an xcontentId here",
		sessId: "pkey or session token"
};
var player = THRONContentExperience("xrrwt", options);
var onNextPage = function(){
     player.nextPage();
};
var onPrevPage = function(){
     player.prevPage();
};
var onGoToPage = function(page){
     player.goToPage(page);
};

<static> cursorTool()

  • Requires input parameters: no
  • Returns a value: no
  • Available for: document

This method can be used to activate the cursor tool, useful to scroll documents.


<static> handTool()

  • Requires input parameters: no
  • Returns a value: no
  • Available for: document

This method can be used to activate the hand tool, useful to highlight documents.


<static> isHandToolActive()

  • Requires input parameters: no
  • Returns a value: yes
  • Available for: document

This method is useful for understanding which tool between hand and cursor is active

Returns:

Returns true if hand tool is active. Returns false if the cursor tool is active

Type
Boolean

<static> scale(scale)

  • Requires input parameters: no, is optional
  • Returns a value: yes
  • Available for: document

This method can be used to set or get the document scale.

Parameters:
Name Type Description
scale String | Number

It accepts as input a number or a string.

  • The number between 0.25 and 10 indicates the zoom level of the document.
  • The string accepts the following values: auto, page-actual, page-fit, page-width, page-height.
Returns:

return scale information. Is an object with these properties:

  • maxScaleAvailable: Indicates the maximum available scale value
  • minScaleAvailable: Indicates the minimum available scale value
  • scale: The scale numeric value
  • scaleValue: The equivalent value in string. For example: "auto", "page-actual", "10".
Type
Object

<static> searchText(text, caseSensitive, highlightAll)

  • Requires input parameters: yes
  • Returns a value: no
  • Available for: document

This method can be used to find a given string into the document.
It highlights the specified text

Parameters:
Name Type Description
text String

text to be searched

caseSensitive Boolean

If true, the search will be case sensitive.

highlightAll Boolean

If true, all matched text will be highlighted. If false, only the first occurrence


<static> searchTextNext(text, caseSensitive, highlightAll)

  • Requires input parameters: yes
  • Returns a value: no
  • Available for: document

This method can be used to find the next matched element

Parameters:
Name Type Description
text String

text to be searched

caseSensitive Boolean

If true, the search will be case sensitive.

highlightAll Boolean

If true, all matched text will be highlighted. If false, only the first occurrence


<static> searchTextPrev(text, caseSensitive, highlightAll)

  • Requires input parameters: yes
  • Returns a value: no
  • Available for: document

This method can be used to find the previous matched element

Parameters:
Name Type Description
text String

text to be searched

caseSensitive Boolean

If true, the search will be case sensitive.

highlightAll Boolean

If true, all matched text will be highlighted. If false, only the first occurrence

Example
//Search listener:
 var onSearch = function(textToSearch, caseSensitive, highlightAll){
     player.searchText(textToSearch, caseSensitive, highlightAll);
 };
 //Next arrow listener:
 var onSearchNext = function(textToSearch, caseSensitive, highlightAll){
     player.prevPage(textToSearch, caseSensitive, highlightAll);
 };
 //Left arrow listener
 var onSearchPrev = function(textToSearch, caseSensitive, highlightAll){
     player.goToPage(textToSearch, caseSensitive, highlightAll);
 };

<static> poster( [imageUrl])

  • Requires input parameters: no, is optional
  • Returns a value: yes
  • Available for: video, video playlists, audio, audio playlists and URL

This method can be used to set or get the poster image.
It may be useful if you want to change the poster with a new one to a certain extent.

Parameters:
Name Type Argument Description
imageUrl String <optional>

An image url, or it also accepts, our getContentDetails service url

Returns:

The poster currently used

Type
String
Example
//At tenth second put the contents in pause, change the poster and print it in the log
var onTimeUpdate = function(playerInstance, currentTime){
     if(Math.round(currentTime) == 10){
         player.pause();
         player.poster("urlImage");
         console.log(player.poster());
     }
};
player.on("timeupdate", onTimeUpdate);

<static> getInterfaceLanguage()

  • Requires input parameters: no
  • Returns a value: yes
  • Available for: all content types

This method returns the interface language used by the Player.

Returns:

The currently used interface language

Type
String

<static> fullscreen()

  • Requires input parameters: no
  • Returns a value: no
  • Available for: all content types

This method can be used to toggle fullscreen status.
There are some limitations:

  • On Safari and mobile devices the fullscreen method must be hooked to a specific user interaction
  • On Safari iOS, the fullscreen for the content type video does not show all the Player components, but only the video object
  • Safari iOS does not implement HTML5 fullscreen, so for any content type different from video it will be simulated by opening the Player to the full page

<static> orientation()

  • Requires input parameters: no
  • Returns a value: yes
  • Available for: all content types

This method can be used to retrieve device orientation.
Method available on mobile devices only.

Returns:

It returns 0 when the device is in landscape mode, 90 when the device is in portrait mode.

Type
0 | 90

<static> share()

  • Requires input parameters: no
  • Returns a value: no
  • Available for: all content types

This method can be used to toggle the content share overlay.
The actions in the overlay can be managed with the shareButtons parameter of the embed code.

Example
//At tenth second show share overlay
var onTimeUpdate = function(playerInstance, currentTime){
     if(Math.round(currentTime) == 10){
         player.share();
         player.off("timeupdate", onTimeUpdate);
     }
};
player.on("timeupdate", onTimeUpdate);

<static> nextContent()

  • Requires input parameters: no
  • Returns a value: yes
  • Available for: available on playlists

This method can be used to move to the next element of a playlist.

Returns:

It returns an item with the following content information:

  • contentType;
  • description;
  • title;
  • channels, which is an array of items. It contains the list of available channels;
  • promise, which is a jquery promise, resolved as soon as all content information are returned.
Type
Object
Example
var onReady = function () {
     var newContent = player.nextContent();
     var onContentReady = function(){
         console.log("Content ready");
     };
     newContent.promise.done(onContentReady);
};
player.on("ready", onReady);

<static> prevContent()

  • Requires input parameters: no
  • Returns a value: yes
  • Available for: available on playlists

This method can be used to move to the previous element of a playlist.

Returns:

It returns an item with the following content information:

  • contentType;
  • description;
  • title;
  • channels, which is an array of items. It contains the list of available channels;
  • promise, which is a jquery promise, resolved as soon as all content information are returned.
Type
Object

<static> goToContent(index)

  • Requires input parameters: yes
  • Returns a value: yes
  • Available for: available on playlists

This method can be used to move to a specific element of a playlist.

Parameters:
Name Type Description
index Number

index of the element to be displayed. Starting index is 0.

Returns:

Returns a jquery promise.
It is solved when a first part of the content information has been downloaded. When promise is resolved, an object with these properties returns:

  • contentType;
  • description;
  • title;
  • channels, which is an array of items. It contains the list of available channels;
  • promise, which is a jquery promise, resolved as soon as all content information are returned.
Type
Promise
Example
var onReady = function(){
     player.off("ready", onReady);
     //Go to third content:
     var loadingPromise = player.goToContent(1);
     //Callback when content is ready:
     var onLoadCompleteLoaded = function(){
         console.log("CONTENT LOADED");
     };
     //Load first part of information:
     var onLoadContent = function(contentInformation){
         contentInformation.promise.done(onLoadCompleteLoaded);
     };
     //on Loaded:
     loadingPromise.done(onLoadContent);
};
player.on("ready", onReady);

<static> nextLinkedContent()

  • Requires input parameters: no
  • Returns a value: yes
  • Available for: all content that has linked content

This method can be used to move to the next element in the linked content list.

Returns:

It returns an item with the following content information:

  • contentType;
  • description;
  • title;
  • channels, which is an array of items. It contains the list of available channels;
  • promise, which is a jquery promise resolved as soon as all content information are returned.
Type
Object

<static> prevLinkedContent()

  • Requires input parameters: no
  • Returns a value: yes
  • Available for: all content that has linked content

This method can be used to move to the previous element in the linked content list.

Returns:

It returns an item with the following content information:

  • contentType;
  • description;
  • title;
  • channels, which is an array of items. It contains the list of available channels;
  • promise, which is a jquery promise resolved as soon as all content information are returned.
Type
Object

<static> goToLinkedContent(index)

  • Requires input parameters: yes
  • Returns a value: yes
  • Available for: all content that has linked content

This method can be used to move to a specific element in the linked content list.

Parameters:
Name Type Description
index Number

index of the element to be displayed. Starting index is 0.

Returns:

Returns a jquery promise.
It is solved when a first part of the content information has been downloaded. When promise is resolved, an object with these properties returns:

  • contentType;
  • description;
  • title;
  • channels, which is an array of items. It contains the list of available channels;
  • promise, which is a jquery promise, resolved as soon as all content information are returned.
Type
Object
Example
var onReady = function(){
     player.off("ready", onReady);
     //Go to third content:
     var loadingPromise = player.goToLinkedContent(1);
     //Callback when content is ready:
     var onLoadCompleteLoaded = function(){
         console.log("CONTENT LOADED");
     };
     //Load first part of information:
     var onLoadContent = function(contentInformation){
         contentInformation.promise.done(onLoadCompleteLoaded);
     };
     //on Loaded:
     loadingPromise.done(onLoadContent);
};
player.on("ready", onReady);

<static> params( [params] [, forceOverride])

  • Requires input parameters: no, is optional
  • Returns a value: yes
  • Available for: all content types

This method can be used to augment embed parameters.
We strongly recommend to use this method into the beforeInit event handler.

Parameters:
Name Type Argument Default Description
params Object <optional>

An object that contains embed parameters.

forceOverride Boolean <optional>
false

If false, item will augment the existing parameters list; if true, item will override the existing ones.

Returns:

The list of embed parameters passed to the player

Type
Object
Examples
//Move share button and play button next to the title
var params = {
     autoplay: true,
 	sessId: "a sessId here",
 	clientId: "your clientId here",
 	xcontentId: "an xcontentId here"
 };
 var onBeforeInit = function(playerInstance){
     var schema = window.THRONSchemaHelper.getSchema();
		window.THRONSchemaHelper.insertBefore(schema, "VIDEO", "captionText", "playButton");
		window.THRONSchemaHelper.insertBefore(schema, "VIDEO", "captionText", "shareButton");
		var paramsAug = {
		    bars: schema,
		    autoplay: false
		};
	    //call params method:
 	playerInstance.params(paramsAug);
     //print true
     console.log(playerInstance.params().autoplay);
 };
 window.player = THRONContentExperience("abwmp4", params);
 player.on("beforeInit", onBeforeInit);
//Try to set autoplay using beforeInit event and params method
var params = {
     autoplay: true,
 	sessId: "a sessId here",
 	clientId: "your clientId here",
 	xcontentId: "an xcontentId here"
 };
 var onBeforeInit = function(playerInstance){
		var paramsAug = {
		    autoplay: false
		};
	    //call params method:
 	playerInstance.params(paramsAug);
     //print true
     console.log(playerInstance.params().autoplay);
 };
 window.player = THRONContentExperience("abwmp4", params);
 player.on("beforeInit", onBeforeInit);

 
//Try to set autoplay using beforeInit event and params method
var params = {
     autoplay: true,
 	sessId: "a sessId here",
 	clientId: "your clientId here",
 	xcontentId: "an xcontentId here"
 };
 var onBeforeInit = function(playerInstance){
		var paramsAug = {
		    autoplay: false
		};
	    //call params method:
 	playerInstance.params(paramsAug, true);
     //print false
     console.log(playerInstance.params().autoplay);
 };
 window.player = THRONContentExperience("abwmp4", params);
 player.on("beforeInit", onBeforeInit);

<static> content(contentInformation)

  • Requires input parameters: no, is optional
  • Returns a value: yes
  • Available for: all content types

This method can be used to retrieve current content details or to change the current content.

Parameters:
Name Type Description
contentInformation String | Object

Method accepts this value as parameter:

  • string: It must be an url of our web service getContentDetails
  • Object: An object containing all the informations needed to load new content: sessId, xcontentId.
Returns:

If no parameters are passed, an object is returned, it returns an object containing the following information of the current content:

  • totalNumberOfElements
  • items, an array of items. If it is a simple content like a single video, its length will be equal to 1
  • id
  • type
  • currentItem, only for playlists, it indicates the current selected item
Type
Object | null
Example
var onReady = function(){
     player.off("ready", onReady);
     //Get content Information:
     console.log(player.content());
     //load new content:
     player.content({
         xcontentId: "d4e31c78-4937-423d-8625-d7afa9369d84",
         sessId: "BrXlRf"
     });
};
player.on("ready", onReady);

<static> linkedContent()

  • Requires input parameters: no
  • Returns a value: yes
  • Available for: all content types

This method returns all the information about linked content.

Returns:

It returns an object containing the following attributes:

  • totalNumberOfElements;
  • currentItem, it indicates the current selected item;
  • items, an array of items. The list of linked content
    Returns null if the content does not have linked content
Type
Object | null

<static> downloadableContent()

  • Requires input parameters: no
  • Returns a value: yes
  • Available for: all content types

This method returns all information about attachments.

Returns:

It returns an object containing the following attributes:

  • items. array of items. Each item has the following attributes: contenttype, description, title, id and a function downloadIt (may not work if executed without user interaction);
  • totalNumberOfElements;
    Returns null if the content does not have downloadable content
Type
Object | null

<static> destroy()

  • Requires input parameters: no
  • Returns a value: no
  • Available for: all content types

This method can be used to destroy a player instance.


<static> on(eventName, handler)

  • Requires input parameters: no
  • Returns a value: no
  • Available for: all content types

This method can be used to set a listener for player events.
The "on" method receives an inupt parameter equal to the event name and the function to be executed (handler).

Parameters:
Name Type Description
eventName string

The name of the event to listen

handler function

The function to call when the event eventName is triggered


<static> off(eventName, handler)

  • Requires input parameters: no
  • Returns a value: no
  • Available for: all content types

This method can be used to remove a listener for player events.

Parameters:
Name Type Description
eventName string

The previously attached event name

handler function

The function previously registered

Example
var onReady = function(){
     player.off("ready", onReady);
     //Get content Information:
     console.log(player.content());
     //load new content:
     player.content({
         xcontentId: "d4e31c78-4937-423d-8625-d7afa9369d84",
         sessId: "BrXlRf"
     });
};
player.on("ready", onReady);

<static> loginAs(loginType, loginValue, contactName)

  • Requires input parameters: yes
  • Returns a value: no
  • Available for: all content types

This method can be used for contact profiling.

Parameters:
Name Type Description
loginType String

it is the type of the provided identity, you can use a free text here (e.g.: "email");

loginValue String

it is the actual value of the provided identity (e.g.: "useremail@email.com");

contactName String

the full name of the profiled contact (e.g.: "Max Grey").

Returns:

Returns a jquery promise, it is solved when the user is profiled correctly

Type
Object
Example
//Profile the contact Max Grey who just provided me its email address:
var onProfiled = function(){
     console.log("USER PROFILED!");
}
player.loginAs('email','max.grey@thron.com','Max Grey').done(onProfiled);

<static> optout(disableBehavior)

  • Requires input parameters: no, is optional
  • Returns a value: yes
  • Available for: all content types

This method can be used to disable user's profiling.

Parameters:
Name Type Description
disableBehavior Boolean

If true the user will never be profiled

Returns:

Returns a jquery promise, when resolved, it returns true if the user has disabled the possibility of profiling the user

//Profile the contact Max Grey who just provided me its email address:
var onDone = function(isDisableProfiling){
console.log(isDisableProfiling);
}
player.optout().done(onDone);

Type
Object

<static> playAdv(urlAdv)

  • Requires input parameters: yes
  • Returns a value: no
  • Available for: all content types

This method can be used to trigger the immediate reproduction of an advertising content.
Advertising support is based on IMA SDK library by Google. Compatibility details are available here

Parameters:
Name Type Description
urlAdv String

url of the advertising to be reproduced.

Example
player.playAdv("http://someAdvertisingUrlHere.com/")

<static> addCompanions(companionIds)

  • Requires input parameters: yes
  • Returns a value: no
  • Available for: all content types

This method can be used to add a slot for an advertising companion.

Parameters:
Name Type Description
companionIds Array

Is the array of domIds where companions must be added.

Example
player.addCompanions(["companionDiv", "companionDiv2"])

<static> remainingTimeAdv()

  • Requires input parameters: no
  • Returns a value: no
  • Available for: all content types

This method can be used to retrieve the remaining time of the advertising being currently displayed.

Returns:

The remaining seconds for adv in play. -1 if adv is already finished.

Type
Number

<static> loadThreeSixty()

  • Require input parameters: no
  • Returns a value: no
  • Available for: 360° Product View

This method can be used to load all the frames (Same as clicking on "Activate 360" button)


<static> startAutomaticRotation(time)

  • Require input parameters: no
  • Returns a value: no
  • Available for: 360° Product View

This method can be used to trigger the automatic rotation of 360 Product View (speed is specified as embed param "timeForAutoRotation", or optionally passed as parameter in the same format)

Parameters:
Name Type Description
time Number

The amount of ms to make a 360 rotation.


<static> endRotation()

  • Require input parameters: no
  • Returns a value: no
  • Available for: 360° Product View

Stops the 360 automatic rotation


<static> showPcrWidget()

  • Require input parameters: no
  • Returns a value: no
  • Available for: any content type with PCR activated

This method can be used to display the PCR widget


<static> hidePcrWidget()

  • Require input parameters: no
  • Returns a value: no
  • Available for: any content type with PCR activated

This method can be used to hide the PCR widget


<static> sidebarToggle()

  • Require input parameters: no
  • Returns a value: no
  • Available for: document

This method can be used to toggle the pdf sidebar