Audio is not played in popup window until window is maximized
Categories
(Core :: DOM: UI Events & Focus Handling, defect)
Tracking
()
People
(Reporter: e.strukova, Unassigned)
References
(Regression)
Details
(Keywords: regression)
Attachments
(1 file)
(deleted),
application/x-zip-compressed
|
Details |
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.
Comment 1•4 years ago
|
||
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);
Updated•4 years ago
|
Updated•4 years ago
|
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?
Comment 3•4 years ago
|
||
Gijs: Could you take a look or set priority/severity?
Comment 4•4 years ago
|
||
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?
Comment 5•4 years ago
|
||
I think this is probably a dupe of bug 1572798. Those patches were almost green on try.
Updated•4 years ago
|
Comment 6•4 years ago
|
||
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.
Updated•4 years ago
|
Updated•4 years ago
|
Comment 7•4 years ago
|
||
Was this fixed by bug 1572798? That change should be in Firefox 86 now.
Comment 8•4 years ago
|
||
(In reply to Mathew Hodson from comment #7)
Was this fixed by bug 1572798? That change should be in Firefox 86 now.
--> Emilio?
Comment 9•4 years ago
|
||
Yes, looks fixed on trunk.
Updated•4 years ago
|
Description
•