Closed Bug 1669736 Opened 4 years ago Closed 4 years ago

Audio is not played in popup window until window is maximized

Categories

(Core :: DOM: UI Events & Focus Handling, defect)

65 Branch
defect

Tracking

()

RESOLVED DUPLICATE of bug 1572798
Tracking Status
firefox-esr78 --- wontfix
firefox81 --- wontfix
firefox82 --- wontfix
firefox83 --- wontfix
firefox84 --- wontfix
firefox85 --- fix-optional
firefox86 --- fixed

People

(Reporter: e.strukova, Unassigned)

References

(Regression)

Details

(Keywords: regression)

Attachments

(1 file)

(deleted), application/x-zip-compressed
Details
Attached file firefox_bugreport.zip (deleted) —

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36 Edg/85.0.564.68

Steps to reproduce:

I created a web page which plays sound via HTML5 audio tag in a popup window. The HTML content of the popup window is created via DOM manipulation on the parent page.
Minimal example is attached.

Actual results:

The audio does not start playing when I click on the play button (or call HTMLMediaElement.play()) despite multiple user interactions with the window and content inside of it. However when I maximize the popup window, the sound starts playing.

Expected results:

The audio should have played when clicking the play button.

Regression window:
https://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=b953c577afe2ddb7511e049fb3130b03a6f5bf1a&tochange=2dd516cee24f58f9b833d9db676c5752b2ba2cd8

Regressed by: e6c09042e670468d2a26c23adbdc448d830d7ea1 Gijs Kruitbosch — Bug 1362774 - don't create about:blank for the initial browser, r=dao

I confirm that it is fixed the issue when manually backed out Bug 1362774 from the bad build.

By the way, a workaround is as follows(I do not know why it works)
user_pref("media.block-autoplay-until-in-foreground", false);

Status: UNCONFIRMED → NEW
Has Regression Range: --- → yes
Has STR: --- → yes
Component: Untriaged → Tabbed Browser
Ever confirmed: true
Keywords: regression
Regressed by: 1362774
Version: Firefox 81 → 65 Branch
Component: Tabbed Browser → DOM: UI Events & Focus Handling
Product: Firefox → Core

Do I understand correctly that this is a known bug? Will it be fixed in future versions of Firefox?

By the way the workaround you mentioned won't help me. I'm a web developer and can't manipulate users' browser settings. Is there any other way to play audio in popup window?

Gijs: Could you take a look or set priority/severity?

Flags: needinfo?(gijskruitbosch+bugs)

docShellIsActive on the browser for the popup window is true when this happens, but only once I toggle docShellIsActive on the browser to false and then back to true, the audio plays.

We probably set it to true at https://searchfox.org/mozilla-central/rev/c2e3ac11be4837718c2604e58085fbc8252b69dd/browser/base/content/tabbrowser.js#403 . It would appear that at that point, this somehow doesn't correctly affect the docshell. Devtools is also unhappy (the inspector is blank and trying to inspect anything in the doc doesn't work).

If I add popupWindow.document.close() to the JS, the testcase works fine as-is.

The fact that cycling the docshell active state makes a difference makes me think the issue here is with docshell code and which bits get set on the unclosed document, though equally I'm not sure why the play invocation doesn't work when the docshell isn't active.

Nika, can you get more clarity out of this?

Flags: needinfo?(gijskruitbosch+bugs) → needinfo?(nika)

I think this is probably a dupe of bug 1572798. Those patches were almost green on try.

Yeah, from my quick reading, this seems like it might be the same underlying issue as bug 1572798. I'm guessing some user activation state or similar isn't being set up correctly when using document.write without a document.close call.

Flags: needinfo?(nika)

Was this fixed by bug 1572798? That change should be in Firefox 86 now.

(In reply to Mathew Hodson from comment #7)

Was this fixed by bug 1572798? That change should be in Firefox 86 now.

--> Emilio?

Flags: needinfo?(emilio)

Yes, looks fixed on trunk.

Status: NEW → RESOLVED
Closed: 4 years ago
Flags: needinfo?(emilio)
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: