(Deprecated) How to interact with THRON Player

(Deprecated) How to interact with THRON Player

 The following article contains legacy Player's method and events. If you are starting a new implementation we recommend you to visit the new portal dedicated to THRON Player.
THRON Content Experience Manager

 

 

 

The browser can communicate with the player to perform some actions. THRONPlayer contains several functions that can be used to interact with the player. APIs seamlessly manage Flash/html5 usage, so you don’t need to worry about it.

 

To embed a new Player you can use two forms: 

 

  1. The "smart" form is to use:
    var playerInstance = THRONPlayer(<domId>,<media>)
    
    Where <domId> is the html id of the div where the player has to be embedded and <media> is the string containing the getContentDetail of the content to be displayed.
  2. The complete form is to use:
    var playerInstance = THRONPlayer(<domId>,{params})
    Where <domId> is the html id of the div where the player has to be embedded and {params} is an object containing all the input parameters (All available parameters are illustrated in this article).

 

 If you want to target a specific player instance you can use the form:

var playerInstance = THRONPlayer(<domId>)

A single entry point is defined for the THRON Player API:

playerInstance.<method>(arguments);

Note: If you want to use JS API with an iframe embed a new JS script is required:

//[clientId]-cdn.thron.com/shared/player/current/scripts/iframe-min.js

Classic embed doesn’t need other scripts. The classic embed form script is the following:

<script type="text/javascript" src="//[clientId]-cdn.thron.com/shared/player/current/scripts/embedscript-min.js"></script>

 

Methods

 [dropdown:Player Configuration]

Player Configuration

Method Description Arguments Available for

playerInstance.destroy()

Stop player's playback, and re-set the DOM to its initial state; all event listeners and timers are cleaned up. Any listener will need to be re-instantiated if another player is set up. None Any content type
playerInstance.content(<url>) Load new content with given ID into the player. If getContentDetail is not provided this method will return basic information of the current displayed content (title, description, duration, id, available channels). 

url(string): the getContentDetail of the content to be displayed. Only getContentDetail is accepted.

Any content type
playerInstantce.poster(<url>) It is used to change the current player's poster. If <url> is omitted, this method will return the actual poster's url
  • url(string): on HTML5 player it can be either a static resource, a getContentDetail or a getThumbnail request. On Flash player, only static resources are allowed.
Any content type
playerInstance.on(<eventName>, <function>) Trigger function's execution at a specific player's event.Events are listed below.
  • eventName(string): the name of the event to be listened
  • function: the javascript function to be executed on the event's interception.
Any content type
playerInstance.off(<eventName>, <function>) Remove previously set Trigger function. See playerInstance.on(). function CANNOT BE ANONIMOUS : if you want to remove a function trigger, you need to pass to .off() method the reference of the same function passed to .on() method.
  • eventName(string): the name of the event that has the trigger you want to remove
  • function: the javascript function that will not be executed anymore. 
Any content type

 [/dropdown][dropdown:Player Playback]

 Player Playback

Method Description Arguments Available on
playerInstance.play(<state>)

Toggle playback status of the player.

If state is set to true the player will start playing, if set to false the player will pause and if omitted the player will toggle playback.

state(boolean)  Video and Audio 
playerInstance.pause(<state>)

Toggle playback status of the player.

If state is set to true the player will pause playing, if set to false the player will start playing and if omitted the player will toggle playback.

state(boolean)  Video and Audio 
playerInstance.seek(<position>)

Seek content to a specific position

position(integer): the timing (seconds) of the content to jump to .  Video and Audio
playerInstance.status() Retrieve the current playback status. None  Video and Audio 
playerInstance.volume(<volume>)

Set audio playback volume.

If volume is not set it will return the current volume level.

volume(number): the volume level in 0-1 range. Video and Audio 

 [/dropdown][dropdown:Template]

 Template

Method Description Arguments Available for
playerInstance.resize()

Re-calculate the proper dimension to fit the relative <div>

None 

 

Any content type

playerInstance.fullscreen(<status>)  

It toggles fullscreen status and returns the current fullscreen state (true or false).

If the state is set to true, the player will enter fullscreen, if set to false it will exit fullscreen. If omitted, the player will toggle fullscreen.

status(boolean): the status of the fullscreen mode.  Any content type 
playerInstance.mediaContainer()

Returns the HTML of the div in which THRON Player instances the media element.

None  Any content type 
playerInstance.container() Returns the entire HTML of the div including THRON Player instance.  None  Any content type 
playerInstance.orientation() Returns 0 when device is in portrait mode, 90 when it is in landscape mode. None Any content type

 [/dropdown][dropdown:Linked content]

Linked content

playerInstance.nextLinked() Makes the player reproduce the next linked content None  Any content type 
playerInstance.prevLinked() Makes the player reproduce the previous linked content None  Any content type 
playerInstance.goToLinked(<index>) Makes the player reproduce the specific linked content index (number) the linked content that has to be displayed  Any content type 
playerInstance.linkedContent()

Returns an object with these attributes:

 

{
  descriptor: <descriptor>, 
  offset:<offset>,
  currentItem: <currentItem>,
  totalNumberOfElements:<totalNumberOfElements>
  items: [items]
}

items contains an array of object. Each object has these attributes:

 

"contentId", "poster", "contentType", "title", "description", "isLiveStream"
None  Any content type 
playerInstance.loadLinkedContent()

Linked items are paginated. If the user wants to load next page he just has to invoke this method.

It returns a promise. It will be solved only when the next page has been loaded.

 
None  Any content type 

 [/dropdown][dropdown:Attachments]

Attachments

playerInstance.downloadableContent()

Returns an object with these attributes:

 

{
  descriptor: <descriptor>, 
  offset:<offset>,
  currentItem: <currentItem>,
  totalNumberOfElements:<totalNumberOfElements>,
  items: [items]
}

items contains an array of object. Each object has these attributes:

 

"contentId", "poster", "contentType", "title", "description", "isLiveStream", "uri"
None Any content type

playerInstance.loadDownloadableContent()

Downloadable content (attachments) are paginated. If the user wants to load the next page he just has to invoke this method.

It returns a promise. It will be solved only when the next page has been loaded.

None  Any content type

 [/dropdown][dropdown:Playlists]

Playlists

Method Description Arguments Available for
playerInstance.next()

Display the next playlist item. If the current displayed content is the last playlist's element, the player will reproduce the first element.

None  Any playlist 
playerInstance.prev()

Display the previous playlist item. If the current displayed content is the first playlist's element, the player will reproduce the last element.

None  Any playlist
playerInstance.goTo(<element>)

Move on to a specific playlist's element. Elements' counting starts from "0". The element must be present in one of the loaded pages (elements list is paginated).

 

element(integer): the element or the page to be displayed  Any playlist
playerInstance.playlistContent()

Returns an object with these attributes:

 

{
  descriptor: <descriptor>, 
  offset:<offset>,
  currentItem: <currentItem>,
  totalNumberOfElements:<totalNumberOfElements>
  items: [items]
}

items contains an array of object. Each object has these attributes:

 

"contentId", "poster", "contentType", "title", "description", "isLiveStream"
None  Any playlist
playerInstance.loadPlaylistContent()

Playlist items are paginated. If the user wants to load the next page he just has to invoke this method.

It returns a promise. It will be solved only when the page has been loaded.

None  Any playlist 

 [/dropdown][dropdown:Other methods]

 Other methods

Method Description Arguments Available for
playerInstance.loginAs(<loginType>,<loginValue>,<contacName>) Provide contact identity to THRON.
  • loginType(string): a label identifying the identity type (e.g.: "email", "crm_id"). "thronuser" is a reserved key.
  • loginValue(string): identity value (e.g. the actual email address)
  • contactName(string, optional): it is the full name of contact.
Any content type

playerInstance.optout(<status>)

This method is used to set the optout status of the current user; if “status” is not provided this method will return a promise which includes a "then" method whose parameter is the current otpout status. If true, analytics data will be anonymous and user profiling will be disabled .

 
  •  status(boolean): the status of the user’s optout. Default false.
     
Any content type 

 [/dropdown][dropdown:Advertising]

Advertising

Advertising support is based on IMA SDK library by Google. Compatibility details are available here.

Method Description Arguments Available for
playerInstance.playAdv(<tag url>) Trigger the immediate reproduction of an advertising, which is primarily useful for live streaming events. tag url (string): the url address of the advertising. Video and Audio. For document and image content type only pre-roll advertising is allowed. Not available on mobile devices.

playerInstance.addCompanions(<domid>)

or

playerInstance.addCompanions(<properties>)

Add a slot for an advertising companion.
  • domId (string): the html id of the div where the companion has to be positioned. If width and height are omitted, this method will return the best matching companion.
  • properties (object): an array of objects containing the item id of the companion, width and height are optionals, if omitted, the best matching companion will be returned.
Any content type.
playerInstance.remainingTimeAdv() Obtain the remaining time of the advertising currently displayed None Any content type

 [/dropdown][dropdown:Global functions]

Global functions

window.THRONdisableUserProfiling(); This feature allows you to implement a custom logic for enabling (or not) user profiling; when the return value is "true ", then analytics data will be anonymous and user profiling will be disabled. None Any content type

 [/dropdown] 

 

Events

[dropdown:Setup]

Setup

Event Description Available for
ready It notifies when the content is ready Any content type
fp_update It notifies when an update of Flash Player is required or a new installation is needed. Any content type
error It is fired every time player's renderisation fails. Any content type

[/dropdown][dropdown:Template]

Template

Event Description Available for
fullscreen

It is fired when the player toggles fullscreen. 

It returns the player's fullscreen state, true when in fullscreen mode, false otherwise.

Any content type 
hoverIn

It is fired when the mouse pointer hovers over the player area

Any content type
hoverOut

It is fired when the mouse pointer hovers out of the player area

Any content type

[/dropdown][dropdown:Playback] 

Playback

Event Description Available for
metadata It notifies when the player receives content metadata Any content type
complete It is fired when a content completes its playback. It has no event attributes. Video and audio content
start It is fired once one time when an audio or video starts Video and audio content
play It is fired when playback of the media starts after having been paused Video and audio content
pause It is fired when the player enters the "paused" status Video and audio content
playlistItemChange It is fired when the playlist index changes to a new playlist item. This event occurs before the player begins playing the new item. Video and audio content
progress It is fired during content playback. It returns elapsed playback time (seconds). Video and audio content 
seekStart It is fired when a user performs a seek on a content. It returns the destination timing (seconds). Video and audio content 

 [/dropdown][dropdown:Advertising]

Advertising

Event Description Available for
advReady

It is fired when the advertising data is available.

Event attributes:

 

{
tag: <adv url>,
duration: <duration>,
title: <title>,
description: <adv description>,
contentType: <adv contentType>
}
Any content type
advStarted

It is fired when the advertising starts playing.

Event attributes:

 

{
tag: <adv url>,
duration: <duration>,
title: <title>,
description: <adv description>,
contentType: <adv contentType>
}
Any content type
advCompleted

It is fired when the advertising completes playing.

Event attributes:

 

{
tag: <adv url>,
duration: <duration>,
title: <title>,
description: <adv description>,
contentType: <adv contentType>
}
Any content type
advAllCompleted

It is fired when the advertising manager is done playing all the ads.

Event attributes:

 

{
tag: <adv url>,
duration: <duration>,
title: <title>,
description: <adv description>,
contentType: <adv contentType>
}
Any content type
advProgress

It is fired when the advertising playhead crosses first quartile, midpoint and complete.

Event attributes:

 

{
tag: <adv url>,
duration: <duration>,
title: <title>,
description: <adv description>,
contentType: <adv contentType>,
playheadStatus: <FirstQuartile | MidPoint | Complete>
}
Any content type
advPaused

It is fired when the advertising is paused.

Event attributes:

 

{
tag: <adv url>,
duration: <duration>,
title: <title>,
description: <adv description>,
contentType: <adv contentType>,
}
Any content type
advResumed

It is fired when the advertising is resumed.

Event attributes:

 

{
tag: <adv url>,
duration: <duration>,
title: <title>,
description: <adv description>,
contentType: <adv contentType>,
}
Any content type
advImpression

It is fired when advertising data is available.

Event attributes:

 

{
tag: <adv url>,
duration: <duration>,
title: <title>,
description: <adv description>,
contentType: <adv contentType>,
}
Any content type
advClick

It is fired when the impression URL has been pinged.

Event attributes:

 

{
tag: <adv url>,
duration: <duration>,
title: <title>,
description: <adv description>,
contentType: <adv contentType>,
}
Any content type
advError  

It is fired whenever an error occours

Event attributes:

String, Error description

Any content type
advCompanions

It is fired whenever an advertising contains companions

Event attributes (An array of all encountered companions): 

Every item has the following attributes:

 

{
tag: <adv url>,
content: <html element>,
size: {height:<height>, width: <width>},
contentType: <Image || Flash>
}
Any content type 

 [/dropdown]

 

Try APIs

 
 
Try available methods by typing their name in the following textfield:

 

playerInstance.

 

 

Was this article helpful?
1 out of 1 found this helpful

Have more questions?

SUBMIT A REQUEST

Hai altre domande?

INOLTRA UNA RICHIESTA

Comments