Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

158
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!