How do make a video play on slide enter, and make it stop on slide exit with impress.js? Upon entering a slide, there is a class ".active". In fact, I can just use a unique ID, I just need to know how to tell impress.js to run on slide enter/exit.
I don't know how to code jQuery, but this was my attempt
document.getElementById('video-audio').addEventListener( ($.Event("keydown", { keyCode: 38 })), function () {WhenPlay()});
function WhenPlay() {
var classList = document.getElementById('video-audio').className.split(/\s+/);
for (var i = 0; i < classList.length; i++) {
if (classList[i] === 'active') {
//console.log(classList[i]);
playVideo();
}
}
}