Skip to content

Where exactly do I paste this code? #255

@blunatic28

Description

@blunatic28

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: #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 #190 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions