Roots Discourse

Can't bind to any events in playlist

Hi all,

For some reason the following code does nothing at all when a track reaches the end:

$('.wp-playlist .mejs-mediaelement audio').on('ended', function (event) { console.log('ended'); });

I’m not able to do anything at all with the playlist and js in sage. The following doesn’t work either:

$('.wp-playlist-item').on('click', function (event) { console.log('clicked'); });

I have lots of other working javascript in this project. I’m putting it in main.js and have tried it in both the home and common init functions.

this seems to be a wordpress/mejs issue rather than sage or jarallax as modifying the core file wp-includes/js/mediaelement/wp-playlist.js seems to work. However, calling it from the theme does not.

Anyone know how to bind to playlist events from the theme?

This topic was automatically closed after 42 days. New replies are no longer allowed.