Web Audio API is not working in background
Categories
(GeckoView :: Media, defect, P3)
Tracking
(Not tracked)
People
(Reporter: royang, Unassigned)
Details
(Whiteboard: [geckoview:2023?])
Steps to reproduce
- open mynoise.net and select any sound generator
- try to switch tab or switch application
Expected behavior
Background audio still plays.
Actual behavior
Background audio stops.
Additional information
The site uses Web Audio API.
| Reporter | ||
Comment 1•5 years ago
|
||
This is an issue created for https://github.com/mozilla-mobile/fenix/issues/15417. With the new MediaSession API this is reproducible.
Comment 2•5 years ago
|
||
@alwu: we don't seem to get any MediaController events on this page, do you see why?
Comment 3•5 years ago
|
||
MediaController only controls media element, as MediaSession API doesn't support web audio.
That might be related with nsGlobalWindowInner::Suspend(), you can check if GeckoView calls that method to pause web audio when GeckoView changes tab's visibility.
What I guess is that, as GeckoView suspends tabs very aggressively, which eventually leads to suspend the inner window that would suspend the web audio as well. So we need to consider if a page is running web audio API as well when determining suspending tabs.
Comment 4•5 years ago
|
||
Let's split this in two bugs and figure out priority.
Comment 5•5 years ago
|
||
Before splitting this bug up, I propose to look into a way to connect web audio playback state events with GV's Media Session API.
As long as the app is not aware of the media playback, it can not display a media control notification.
Without the media notification, the app may (and will) be killed once it's in background. I don't think we have to differentiate between a tab vs. the whole app being in background, for this reason.
In summary: we either support web audio events through the Media Session API or suspending playback when in background (as is the case) is the correct behavior.
Updated•5 years ago
|
Updated•3 years ago
|
Comment 6•3 years ago
|
||
Makoto says this bug is needed for MediaSession API.
Comment 7•3 years ago
|
||
Moving some media bugs to the new GeckoView::Media component.
Description
•