How to Use the Player Extension 'view' Constructor

The 'view' constructor is an API that allows you to obtain an HTML container to implement your extension's UI elements on the player.

The view constructor has a single method called 'getContainer' that can return one of the following elements:

  • PLAYER_CONTAINER - An inner container available for HTML5 players that can be used to implement UI elements either on an Ad or Content etc.

  • TAG_CONTAINER - A container available for both Flash & HTML5 players but it will be placed over the whole player tag.


To retrieve an HTML element from the 'videw' constructor you will need to use the following JavaScript syntax:

function doSomethingWithContainer(container) {
// Do some action with the container you have recieved
// For example: container.appendChild(...);

view.getContainer(view.PLAYER_CONTAINER).catch(function () {
// If the player is HTML the container is passed to the previous function
// If the player is Flash the method will fallback and call TAG_CONTAINER
return view.getContainer(view.TAG_CONTAINER);

Note: This JavaScript code will allow you to obtain the appropriate container based on the player (either HTML5 or Flash).

Have more questions? Submit a request