Background playback doesn't work in the new Fenix version of Firefox for Android
Steps to reproduce
- Use the new Android Firefox (Fenix-based).
- Queue up multiple songs to play in Funkwhale.
- Start them playing.
- Switch away from the browser or lock the phone.
What happens?
Payback will stop when the song ends and Funkwhale will not continue on to the next track in the queue.
I think the tab is getting declared inactive and suspended by the browser. When I set dom.suspend_inactive.enabled
to false
in about:config
, playback continues to the next track correctly. But it also seems to run into https://github.com/mozilla-mobile/fenix/issues/1461: playback is slightly choppy/distorted, presumably because the browser isn't waking up enough to play the audio consistently and meet relevant deadlines.
I think the distortion still occurs when the about:config
workaround is not set. It just only affects the first song because that's all it will play.
What is expected?
Playback should continue through the whole queue, with no distortion or delay in providing audio data to the output.
There also probably ought to be a system-level media player notification displayed by the browser, with media controls that control Funkwhale.
Context
Funkwhale version(s) affected: 0.21.2
This problem may be because the browser hasn't been informed that the page is a media player; the tab in the tab list lacks the integrated pause button that other media sites have, and there's no system media-playing notification created (which is a new feature this version of Android Firefox is supposed to provide). Apparently this notification is an important part of making sure the app wakes up enough to keep the media playing smoothly (see the linked issue).