audiojs
audiojs copied to clipboard
Where exactly do I paste this code?
Hello,
I am not experienced in coding, but I just customized a template and multiplied the players in my html, but obviously only the first one works (same issue as @hexplor had, here: https://github.com/kolber/audiojs/issues/223).
I don't know where to paste this snippet provided by @patricklewis, I would appreciate your feedback. Or, if it's hard to explain, and someone can edit the file for me, I don't mind paying for your services.
My website is online, you can see the issue: www.christinageorgioumusic.com
Thanks! Christina
As part of my work to write a script that would play sequentially through a list of multiple audio.js players on a page (representing CD tracks) I was able to call play() on audio.js instances and have the targeted player update to display a 'play' icon:
$('.audiojs').each(function(index) {
var container = $(this);
var audioPlayer = container.find('audio');
audioPlayer.nextPlayerInstance = 'audiojs' + (index + 1);
audioPlayer.on('ended', function() {
if (audiojs.instances[audioPlayer.nextPlayerInstance]) {
audiojs.instances[audioPlayer.nextPlayerInstance].play();
}
});
});
Originally posted by @patricklewis in https://github.com/kolber/audiojs/issues/190#issuecomment-180565736
Instead of multiple players, why not have one player with a song list?