Closed Bug 1733902 Opened 3 years ago Closed 3 years ago

Autoplay fails if the player is switched in a background tab

Categories

(Core :: Audio/Video: Playback, defect, P3)

Firefox 92
defect

Tracking

()

VERIFIED FIXED
96 Branch
Tracking Status
firefox96 --- verified

People

(Reporter: gordie.lachance, Assigned: alwu)

References

Details

Attachments

(4 files, 1 obsolete file)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:92.0) Gecko/20100101 Firefox/92.0

Steps to reproduce:

Steps to reproduce the problem:

  • Open the playlist https://v2.spiff-radio.org/playlist/349303
  • Play the track #3 (Youtube), which is just before a Soundcloud track
  • Go to another tab so the playlist is in a background tab.
  • Wait for track #3 to end :
  • Track #4 won't start until the tab is active again.

Actual results:

It seems that, since there is a player change (youtube > soundcloud) and that the page is in a background tab; it fails to autoplay the next track (even if autoplay is allowed in the browser's settings).
It works when skipping to a track from the same source (youtube > youtube for instance) or if the tab is active.

Expected results:

If the website is whitelisted, it should be able to skip and play the next track.
NB : Chromium had the same problem and fixed it (https://bugs.chromium.org/p/chromium/issues/detail?id=1244074).

The Bugbug bot thinks this bug should belong to the 'Core::Audio/Video: Playback' component, and is moving the bug to that component. Please revert this change in case you think the bot is wrong.

Component: Untriaged → Audio/Video: Playback
Product: Firefox → Core

Alastor, could you please help? Thanks!

Flags: needinfo?(alwu)

This is caused by this, where we check the media suspend state from a wrong outer window. We should check the top level outer window (for spiff-radio), not the iframe's outer window (soundcloud).

Assignee: nobody → alwu
Severity: -- → S3
Flags: needinfo?(alwu)
Priority: -- → P3
Attachment #9245355 - Attachment description: Bug 1733902 - part1 : create a new sync attribute for whether we should delay media from starting on the top level browsing context and use it to replace the old attribute on outer windows. → Bug 1733902 - part1 : create a new sync attribute on top-level browsing context for whether we should delay media from starting, and use it to replace the old attribute on outer windows.
Attached file Bug 1733902 - part4 : add a test. (deleted) —
Pushed by alwu@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/e20cfb194c38
part1 : create a new sync attribute on top-level browsing context for whether we should delay media from starting, and use it to replace the old attribute on outer windows. r=nika,emilio
https://hg.mozilla.org/integration/autoland/rev/6a4be38e6586
part2 : use the new method to check if we should delay media from starting playback. r=emilio
https://hg.mozilla.org/integration/autoland/rev/7e520eb5e476
part3 : merge RefreshAgentsSuspend into NotifyResumingDelayedMedia. r=emilio
https://hg.mozilla.org/integration/autoland/rev/768a740658dd
part4 : add a test. r=emilio

Did you see the question about ReplacedBy here Alastor? https://phabricator.services.mozilla.com/D128126#4226792

Nika, do you have opinions on ^?

Flags: needinfo?(nika)
Flags: needinfo?(alwu)

Ah sorry I missed that question. I will submit another patch if we need to modify the current patch.

Flags: needinfo?(alwu)

Copying over in ReplacedBy seems reasonable to me.

Flags: needinfo?(nika)
Blocks: 1739685

Comment on attachment 9249090 [details]
Bug 1733902 - part5 : copy ShouldDelayMediaFromStart in ReplacedBy() .

Revision D130292 was moved to bug 1739685. Setting attachment 9249090 [details] to obsolete.

Attachment #9249090 - Attachment is obsolete: true
QA Whiteboard: [qa-96b-p2]

Reproduced the issue on an affected Nightly build 94.0a1 (2021-10-04), Win 10 x64.
Verified fixed on Firefox 96.0 (20220106144528), across the following platforms: Win 10 x64, Ubuntu 20.04 and macOS 10.15.

Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: