Open Bug 1706993 Opened 5 years ago Updated 8 months ago

WebAudio API is playing silence all the time

Categories

(Core :: Web Audio, task)

Firefox 88
x86_64
Linux
task

Tracking

()

People

(Reporter: estemal, Unassigned)

References

Details

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0

Steps to reproduce:

  1. Open Duolingo website (https://www.duolingo.com/learn, you need a free account). I heard that Soundcloud also does that while playback is paused, but I can neither confirm nor deny it.
  2. Run a command line tool to see if there is any running stream. I'm using pipewire, so I run pw-dump | grep -C 10 running, but with pulseaudio you can run pacmd list-sink-inputs and see if there are streams with state: RUNNING.

Actual results:

I have a stream named "AudioCallbackDriver", that has always "running" state even when no sound is played, which means it plays silence. This causes issues like this https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/1079

Expected results:

All the streams should me idle when no sound is played.

Component: Untriaged → Audio/Video: Playback
OS: Unspecified → Linux
Product: Firefox → Core
Hardware: Unspecified → x86_64
Component: Audio/Video: Playback → Web Audio

I haven't had a chance to investigate yet, but I see https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/1079#note_890831 confirms that this also occurs with Chromium, so it's likely this is a case where the web app (DuoLingo) needs to use AudioContext::suspend when idle.

I don't know if there is a problem with webapp or not, but I think, it's just wrong when incorrect webapp on my PC can mess up bluetooth audio playback on my phone.

This is a problem of the web app. I've contacted SoundCloud and DuoLingo also have been contacted. I will report back when I have news. This happens on all OSes and not only Firefox (all browsers that implement the Web Audio API).

Status: UNCONFIRMED → NEW
Ever confirmed: true

Not closing this to keep tracking it, but moving to a "task" so it's out of the triage lists.

Severity: -- → N/A
Type: defect → task
See Also: → 1165677

Easy way to reproduce this:

  1. go to https://translate.google.com

  2. input any word into the translate box

  3. press the "Listen" button

after this the browser continues playing silence until you close this tab or reload the page

On firefox-102 the problem remains even though bug #1743834 was fixed.

Confirmed in 111.0.1 (64-bit) Canonical Snap for Ubuntu (canonical-002 - 1.0), running on Ubuntu Studio 23.04 with the latest patch set as of now.

Playing audio from the BBC News website also has the same effect. To be honest, I suspect most sites will.

The problem is still not fixed.

The problem is still pesent. I just found out that even aliexpress has this problem. I don't even know what it uses WebAudio API for, but it just hangs there and plays silence, making me unable to listen anything on my phone.

This bug just costs me too much notebook battery and the silent whitenoise sound my speakers make is annoying.
Popular sites like discord, x.com, outlook web and (I suspect a lot more) open AudioContexts without ever suspending them.

That's why I created an extension to autosuspends new AudioContexts after two seconds. The extension also tries to detect if the .start() method is called on an audiobuffer and then auto resumes the AudioContext for another 2 seconds.

https://addons.mozilla.org/en-US/firefox/addon/audiocontext-suspender/

As much as these sites are buggy it is clear that this is a widespread issue and we can't rely on websites to behave properly.

It seems that some heuristic is needed to suspend audio contexts when unused. A simple idle timer is probably sufficient but more complexity can be imagined such as if the website has suspended context on its own in the past.

I also found that aliexpress does this. For no reason at all. At the very least Firefox should have indication for the tabs that do this.

You need to log in before you can comment on or make changes to this bug.