Player API (eng)

To control the player and to get its events you can use Javascript API.

Viqeo Script Load

VIQEO object is available on the page if player code is inserted there. To subscribe on events from global VIQEO object you need to use onViqeoLoad event.

Example
var start = function(VIQEO) {
  // Put here a code to be executed after VIQEO load
}
if (!window.VIQEO) {
  window.onViqeoLoad = start;
} else {
  start(window.VIQEO);
}

If you need few points of entrance, write to onViqeoLoad array of functions.

Example
window.onViqeoLoad = [function(VIQEO) {}]


Events

To listen events from the Player(s) please use following function:

Events listening
VIQEO.subscribeTracking(callback, eventName)

If an event is equal to condition function callback(options) would be executed.

Example
{ 
  container: 'extPlayer', // block where event is fired
  eventName: 'Player:started', // Event name
  videoId: 'id123', // Unique player ID (In normal and video mode one ID is used)
  player: player, // player object where an event is fired
  
  /**
  * Params below are sent only from External player
  */
  originalParams: { videoSrc: '', previewSrc: '', selector: '' }, 
}

eventName - object or string with event name

All available values of container:

  • extPlayer - External players;
  • stdPlayer - Standard players
  • recommendPlayer - Recommendations Players;
  • vmodePlayer - Player in video mode;
  • recomendVmodePlayer - Recommendations Player in video mode

All available values of eventName:

  • Player:started - Player started to play;
  • Player:ended - Video is watched until the end;
  • Player:paused - Player is paused;
  • Player:replayed - Player started to play after finishing a video;
  • Player:played - Player is resumed;
  • Player:changedSize - Player changed its sizes;
  • Player:previewLoaded - Video preview is loaded;
  • Player:videoLoaded - Video is loaded.
Example
// Will be fires for ALL players on the page when videos are started:
VIQEO.subscribeTracking(function(options) {}, 'Player:started')
// Will be fired for all External players on the page when videos are started
VIQEO.subscribeTracking(function(options) {}, { eventName: 'Player:started', container: 'extPlayer' })