[Bug] Phone goes to sleep while audio is playing
Steps to reproduce
- Go to music.youtube.com
- Play a song without maximizing the video.
- Wait
Expected behavior
- Song keeps playing.
Actual behavior
- After a bit the phone gets locked and the music stops playing. This doesn't happen if you maximize the video.
Device information
- Android device: Galaxy A20 with Android 9
- Fenix version:
Nightly 190904 18:02 (Build #12471814) 📦: 11.0.0, 0c63c199a 🦎: 70.0a1-20190901094958
┆Issue is synchronized with this Jira Task
Can someone please re-test? I tried with a 15sec screen sleep, for me the phone didn't get locked. Tried on: Oneplus 7T pro and Samsung Note 10
Hi, I've just checked this matter on the latest Nightly #20490606 from 2/18 having the following devices set to sleep after 15 seconds of inactivity :
• Google Pixel 3a XL (Android 10)
• Google Pixel 3a (Android 9)
• Huawei Mate 20 Lite (Android 8.1.0)
• Samsung Galaxy S7 (Android 7.0.0)
• One Plus A3 (Android 6.0.1)
If you play any song that has an actual video
✔️ The screen will not go to sleep.
►Video

If you play the audio (doesn't have an actual video)
❌The screen goes to sleep and the playback is paused. Managed to reproduce this on: • Google Pixel 3a XL (Android 10) • Google Pixel 3a (Android 9) • Huawei Mate 20 Lite (Android 8.1.0)
►Video

❌ The screen goes to sleep and the playback is not paused. Managed to reproduce this on: • Samsung Galaxy S7 (Android 7.0.0) • One Plus A3 (Android 6.0.1)
As a daily user of the music.youtube app, the screen should not go to sleep on any circumstance while audio/video playback is performed.
This issue reproduces also on Fennec (and GeckoView Sample), therefore it's most likely a GV issue. I'm assuming it's either the video encoding for the image+audio combo that gets treated as simple audio and doesn't acquire a wakelock.
Last place I was looking into was HTMLMediaElement.h in gecko, which has MediaInfo class, with hasVideo() and hasAudio() methods. The difference between the working ones and non-working ones could be hasVideo() = false.
Added a bugzilla bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1617591
I came to report the same issue playing BBC audio streams, like https://www.bbc.co.uk/sounds/play/live:bbc_world_service. Chromium-based browsers keep the audio playing so I can listen to the radio when reading another tab or with the screen off.
I encountered this issue on the 1/17 Firefox Nightly build with www.rockfm.ro with Sony Xperia Z5 Premium (Android 7.1.1).
I was able to reproduce the issue on the 86.0.0-beta.2 build with Samsung Galaxy Tab A6 (Android 5.1.1) on www.guerrilla.ro/player/ , and on rockfm.ro.
I reproduced this issue on rockfm.ro, on RC 89.1.1 with Samsung Galaxy Tab A6 (Android 5.1.1).
I was able to reproduce this issue on 90.1.2 build with HTC 10 (Android 8).
See: https://github.com/mozilla-mobile/fenix/issues/17373 This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.