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

159
Visualizações
Detect if audio is playing on the website

This is somewhat a duplicate of this question, but I do not understand on how to use the accepted answer. Furthermore the question is quite old and maybe there is a better way available now.

My use case:

I want to test if audio in general is playing with Playwright. The audio source is not a DOM-Element, so checking media elements is not a solution.

This is how the code would get used:

const isAudioPlaying = page.evaluate(() => {
    /* Code goes here */
})

Edit: And this is how the code of the media playback looks like in its most simple form:

function createAudioPlayer() {
    const audio = new Audio()

    return {
      setSource: (src) => audio.src = src,
      play: () => audio.play,
      pause: () => audio.pause,
      resume: () => audio.resume,
    }
}

This factory just uses the default Audio constructor for the playback. It never touches the DOM like that.

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