Hooking into the `_onPlayerReady` event allows us to notify the user the video is ready
Using the `onStateChange` param, we can interact with the advert based upon what the video is doing.
var myVideo = new Player({
videoId: 'pPWKJTo2GXw',
placement: '.container',
mute: 1,
onStateChange: {
playing: function() {
// Some code here...
},
paused: function() {
// Some code here...
},
ended: function() {
// Some code here...
}
},
_onPlayerReady: function() {
var heading = document.querySelector('.heading');
heading.className += ' ready';
}
});