Background playback doesn't work on some Android browsers
Steps to reproduce
Different problem, but similar steps as in issue #1214 (closed)
- Use last version of Google Chrome (91.0) or Brave (1.26.71) on an Android device.
- Queue up multiple songs to play in Funkwhale.
- Start them playing.
- Switch away from the browser or lock the phone.
What happens?
Playback stops when the song ends. It will only resume when we switch back to the browser.
What is expected?
Playback should continue through the whole queue.
Context
Last version of Firefox (89.1.1) is not affected. I've reproduced it on Nexus 5x (Android 8.1.0), Pocophone F1 (Android 10) and Xiaomi Redmi Note 6 Pro (9) with Chrome and Brave.
I've debugged the front-end and the problem might be introduced in 75a1d749, specifically in this line. For whatever reason Howler.stop()
prevents next playback when the browser's tab is inactive.
I reverted the modification locally and deployed to my own instance. Now everything works fine. I'd love to submit a PR but I can't reproduce the issues (#1213 (closed) and #1387 (closed)) that motivated 75a1d749. Maybe @heyarne could shed some light on this question?
Funkwhale version(s) affected: 1.1.1 and 1.1.2
Note: The music stops even when battery optimization is disabled.