New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 673145 link

Starred by 1 user

Issue metadata

Status: WontFix
Owner: ----
Closed: Dec 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 3
Type: Bug



Sign in to add a comment

Audio element's play is postponed until the page goes into foreground

Reported by skopin...@gmail.com, Dec 11 2016

Issue description

Chrome Version: <55.0.2883.87 64-bit>
URLs (https://ru.999dice.com) :
OS version: Windows 10

What steps will reproduce this crash (or if it's not reproducible,
what were you doing just before the crash)?
(1) open https://ru.999dice.com/
(2) f12 paste
        function soundz() {
                window.audio = {};
                audio["alert"] = new Audio();
                audio["alert"].src = "https://cdn.rawgit.com/hamboning/999dice-toys/master/codecx.wav";
                window.audio["alert"].play();
                return false;
        }
        flag_last_button = true;
        function AlertButton() {
                BtcRainButton = $(".Rain").text();
                checkRainMax = (/BTC/i.test(BtcRainButton));
                if (checkRainMax && flag_last_button)
                {
                        soundz();
                        flag_last_button = false;
                }
                if (!checkRainMax)
                {
                        flag_last_button = true;
                }
        }
        $('#ChatTab').bind('DOMSubtreeModified', AlertButton);

(3) нужно подождать пока появится кнопка с текстом <btc|doge|ltc|eth> (появляется в чате раз в два часа или раньше)- (если переключиться на другую вкладку или свернуть браузер, то звук в скрипте при появлении кнопки не сработает, а если вернутся на страницу после появления кнопки на пару минут к примеру то звук сработает в момент перехода на эту страницу а не тогда когда появляется кнопка и в дальнейшем звук на кнопку срабатывает правильно.)
 

Comment 1 by ajha@chromium.org, Dec 12 2016

Labels: M-55 OS-Windows
Labels: prestable-55.0.2883.87
Cc: durga.behera@chromium.org
Labels: Needs-Feedback
Added the Google Translate for point 3:

3) must wait until the button with the text appear <btc | doge | ltc | eth> (displayed in the chat every two hours or sooner) - (if you switch to another tab or minimize the browser, the sound in the script does not work with the appearance of a button, and if return to this page after the appearance of the buttons for a few minutes, for example the sound of fire when go to this page and not just when there is a button to continue to sound on button works properly.)

skopin666@ : Thanks for the report.Could you please help with a minimised test case to triage further.
Cc: mlamouri@chromium.org
Components: -Internals>Media Blink>Media>Audio
Status: Untriaged (was: Unconfirmed)
Summary: Audio element's play is postponed until the page goes into foreground (was: <Replace this with a summary. This form is for audio/video issue (HTML5).>)
The translation is pretty close to the text, except for the last bits about the sound of fire :)

I think the problem here is delaying the sound because the page is in the background, I forget if we suspend play() until the page is visible or is it something about generic JS throttling that's enabled unless the page is making sound already.

I think developers should use the Notifications API that has a way to specify a sound for notifications in the spec, see: https://notifications.spec.whatwg.org/#dom-notificationoptions-sound. However, there's no support for this feature yet according to MDN and it's in the backlog for the Chrome's notifications team with no ETA.
I think we block the page from making noise if it never made sound while visible. I don't think we would do anything else on desktop.
Status: WontFix (was: Untriaged)
I think this is a won't fix then - we don't want pages to make sound from the background without user consent. Use Notifications API (whenever sound is supported) or use the page visibility API to stop making sounds when in the background.

Sign in to add a comment