The Event callbacks section of the outstream player is designed for various custom implementations. It allows you to use some of the most commonly used events of the player to set up custom JavaScript callbacks without needing to make changes to the embed code.
Supported Player Events:
- ready: Fired when the player is ready for API manipulation.
- adStart: Fired when an ad starts playback.
- adImpression: Fired when an impression pixel is fired from an ad.
- adError: Fired when an ad encounters an error, including empty VAST responses.
- adEnd: Fired when an ad finishes playback.
- start: Fired when video content starts playback.
- end: Fired when video content finishes playback.
For more details on the player's JS API event system, please visit this link: JavaScript API Reference
How to Add a Custom JavaScript Callback:
- Log in to the CMS and navigate to the AD UNITS section, then Settings Templates and select the ad unit template you want to edit.
- Scroll down to the EVENT CALLBACK section of the template and expand the accordion.
- Click the ADD CALLBACK button to create a new callback.
- Choose the event you want to use for your custom implementation from the dropdown list.
- Enter valid JavaScript code to the right of the dropdown. This JS code will be called by the player and executed when your selected event fires. Avoid using HTML code in this text field, and ensure your JS code is error-free.
- Add another callback if needed, then click SAVE.
You have successfully added a custom callback implementation to your player without making any embed code changes!
NOTE: You can use the "this" keyword as a reference to the player always. For example:
console.log('player object', this);
this.play();
Comments
0 comments
Please sign in to leave a comment.