mediaelement.js and custom playlist

Viewed 21403

I have such code (for example):

<script>
$('audio').mediaelementplayer();
</script>

<audio id="mejs" controls="controls">
    <source src="/media/file-2.mp3" type="audio/mp3" />
</audio>

<ul class="mejs-list">
    <li>/media/file-1.mp3</li>
    <li class="current">/media/file-2.mp3</li>
    <li>/media/file-3.mp3</li>
</ul>

I need to play audio files from the list by queue (one after another).

How can I change the source of the audio for the next file from the list after finishing playing current file and start playing the next one?

Update: related topic about mediaelement.js and playlist but the answer is about using many mediaelementplayer() instances.

3 Answers

Have a look at the YouTube Playlist for MediaElement.js. It provides a playlist for YouTube videos but can be easily updated to support other video formats

Related