Sample Code - Player API

Cedato Support -

Below is a sample code that demonstrates a player with an “Expand” button. Clicking on the button will result in a player resize. Please note that you have to change the player IDs (below “111111111”) and CB (below [CB]) to your own.

<html>

<head>

 <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1,    
   maximum-scale=1, minimum-scale=1" />

</head>

<body>

<h1>Cedato Player API Sample Code</h1>

<button name="Expand" style="margin:10px;background-color:orange;color:white">Expand</button>

<!-- CEDATO API SECTION -->

<!-- Must be included before the Cedato Tag →

 

<script type="text/javascript">

var cedatoDivId = 'video111111111[CB]'; // Has to match id of the cedato tag main div

window.CEDATO_INIT=(window.CEDATO_INIT || {});
window.CEDATO_INIT[cedatoDivId] = function() {
  
   var apiInterface = this; // store API for further usage

   // using api functionality
   apiInterface.overrideInitParams({autoplay: false});
   apiInterface.sound(false);

setupPlayerInteraction(this);

 };

 // set up required player api interactions

 function setupPlayerInteraction(cedatoApi) {

console.log("Cedato Player - Started");

// Get player's div

var playerContainer = document.getElementById(cedatoDivId);

// Turn sound on while mouse hovering over player's div

 playerContainer.addEventListener('mouseenter', function() {

    cedatoApi.sound('on');

    }, false);

playerContainer.addEventListener('mouseleave', function() {

    cedatoApi.sound('off');

    }, false);

// setup timeout of 60 seconds after player is started

setTimeout(function () {

  console.log("Cedato Player - a minute passed");

}, 60000);

// Invoke callback on Ad Start

cedatoApi.on('adstart', function() {

  console.log("Cedato Player - Ad started");

});

// Register button click events

document.querySelector("button[name=Expand]").addEventListener('click', function() {

  cedatoApi.resize(600, 480);

}, false);

  }

</script>

<!-- CEDATO TAG STARTS HERE -->

<!-- Div id has to match playerId and cb in the script below and in the API section script →

 

<div id="video111111111[CB]" style="width: 300px; height: 250px;">

<script src="http://p.algovid.com/player/player.js?p=111111111&sid=EXTRACTED_DOMAIN&cb=[CB]&w=300&h=250&d=[URL]" type="text/javascript"></script>

</div>

<!-- CEDATO TAG ENDS HERE -->

</body>

</html>

Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.