Skip to content

A button to play all mp3s on the page in order #2

@simonw

Description

@simonw

I did this in the DevTools console and it's really fun:

image

function playAllAudios() {
    let audios = Array.from(document.querySelectorAll('audio'));
    function playNext() {
        if (!audios.length) {
            return;
        }
        let next = audios.shift();
        next.addEventListener('ended', playNext);
        next.play();
    }
    playNext();
}
playAllAudios();

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions