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

192
Views
Using AudioContext stops the audio from playing in the background

I've been playing around with the Web Audio API and ran into a weird problem.

At the moment, if you open a web page on your phone and click the play button on an HTML5 audio element, the audio will keep playing in the background even after switching apps.

However, when you attach the element to an AudioContext, the audio will stop playing in the background after switching apps.

To attach the element, I'm using the following:

const context = new AudioContext()
const source = context.createMediaElementSource(document.querySelector("audio"))

source.connect(context.destination)

So even though I'm simply connecting the HTML5 audio element to the context's destination WITHOUT controlling it, the audio stops playing as soon as I switch apps.

Does anyone know why this is happening and how I can get the audio to keep playing in the background even after switching apps? It's odd that we can use the Web Audio API to control audio on the web, but we have to keep our browsers open and our phones unlocked to listen to that audio.

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

The intended behavior is for audio to stop on browser exit on phones, because it saves on background processing and from a user standpoint, I think the expected behavior would be that audio stops when you close out.

I think you just have audio working incorrectly on the specific device.

over 4 years ago · Santiago Trujillo Report
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!