Created
October 23, 2016 14:48
-
-
Save dimified/61be400d49f679e8ec008fa6f65b9c80 to your computer and use it in GitHub Desktop.
Stream event listener (HbbTV 2.0)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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