Capture mediaelement events

I’m trying to capture a couple of media element player events to no avail. There’s a great API list of events available, but little documentation on how to implement. No examples. Here’s what I’ve tried:

mejs.players[id].media.on(‘play’,function(){
console.log(‘playing’);
});

mejs.players[id].media.events.on(‘play’,function(){
console.log(‘playing’);
});

mejs.players[id].container.on(‘play’,function(){
console.log(‘playing’);
});

Looking at the mejs.players[id] object in the Chrome console shows that there’s mejs.players[id].media.events.play (canplay, playing, pause etc) events, but when I try

mejs.players[id].media.events.on(‘play’,function(){
console.log(‘playing’);
});

I get

mejs.players[id].media.on is not a function

Read more here:: Capture mediaelement events

Leave a Reply

Your email address will not be published. Required fields are marked *