Here are all the variables and functions you can utilize at the moment with your Vidalytics embed code. We're working on documenting our full API, but here are some things you can do to customize your embed code in the meantime! 

<script>
var EMBED_CODE_ID = 'vidalytics_embed_XXXXXXXXXXXXXXXX'; // update this to match your Vidalytics Embed ID
var vidalyticsPlayerAPI = null;

function initializePlayerAPI() {
console.log('initializePlayerAPI()');
var player = getPlayer();
if (player._player) {
vidalyticsPlayerAPI = player;
onPlayerAPIAvailableCallback();
return;
}

setTimeout(initializePlayerAPI, 100);
}
initializePlayerAPI();

function getPlayer() {
console.log('getPlayer()');
var embeds = (_vidalytics || {}).embeds || {};
if (embeds[EMBED_CODE_ID]) {
return embeds[EMBED_CODE_ID].player || {};
}
return {};
}

function onPlayerAPIAvailableCallback() {
console.log("onPlayerAPIAvailableCallback()");

// do something related to current video playback time
vidalyticsPlayerAPI._player.addEventHandler('onPaused', function () {
console.log('onPaused event');
});
vidalyticsPlayerAPI._player.addEventHandler('onPlay', function () {
console.log('onPlay event');
});
vidalyticsPlayerAPI._player.addEventHandler('onPlaybackFinished', function () {
console.log(‘onPlaybackFinished event');
});
vidalyticsPlayerAPI._player.addEventHandler('onTimeChanged', function () {
if (vidalyticsPlayerAPI.getCurrentVideoTime() > 5) {
// do something after 5s of playback
}
});

// the other available methods are:
// vidalyticsPlayerAPI.play()
// vidalyticsPlayerAPI.pause()
// vidalyticsPlayerAPI.seekTo(timeInSeconds) ie. seekTo(205) would jump to the 3:25 (180s=3m + 25s)
}

</script>
Did this answer your question?