Skip to content

Instantly share code, notes, and snippets.

@dimified
Created October 23, 2016 14:48
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dimified/61be400d49f679e8ec008fa6f65b9c80 to your computer and use it in GitHub Desktop.
Save dimified/61be400d49f679e8ec008fa6f65b9c80 to your computer and use it in GitHub Desktop.
Stream event listener (HbbTV 2.0)
/**
* Stream event callback
*/
const callback = (e) => {
if (e.status === 'trigger') {
if (Playlist[e.text]) { // globally defined playlist
_currentAd = this.view.showAd(Playlist[e.text]); // saving in the context of Controller
}
}
};
/**
* Name of stream event declaration file
*/
const xmlUrl = '/stream-event';
/**
* Name of the event
*/
const eventName = 'pro7';
/**
* Adding stream event listener on video object
*/
this.vid.addStreamEventListener(xmlUrl, eventName, callback);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment