Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

151
Visualizações
Audio playback after event (e.g. resume audio after call)

I'm working on a small web application that plays my favourite radio live streams. Now there's an issue when the stream gets interrupted by a call or different media: it disappears. I would expect the audio to automatically resume after the event ends (e.g. end of call), however this is not the case. I have searched through the forums but nothing seems to compare/work. I have tried a boolean to determine the playing state, but this just messes up whenever I manually hit the stop button. Here's my code so far:

const radioList = [
    {
        "radioName": "Ibiza Live",
        "radioStream": "https://streams.radio.co/sdc9cfaf77/listen",
        "imgUrl": "../img/ibizalive.png"
    },
];

const radioContainer = document.querySelector('.stationsContainer');

// Render markup
const radioMarkup = (img, name, audio) => {
    const html = `
        <div class="station">
            <img src="${img}" alt="${name}" data-id="station">
            <div class="live">
                <div>
                    <div></div>
                    <div></div>
                    <div></div>
                    <div></div>
                </div>
            </div>
            <audio src="${audio}"></audio>
        </div>
    `
    radioContainer.innerHTML += html;
}

radioList.forEach(i => {
    radioMarkup(i.imgUrl, i.radioName, i.radioStream);
})

// Play radio
const audio = document.querySelectorAll("audio");
const stationList = document.querySelectorAll(".stationsContainer .station");

stationList.forEach((station, i) => {
    station.addEventListener('click', () => {
        stopAllAudio();
        audio[i].load();
        audio[i].play();
    })
})

How can I make the audio resume after an event?

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda