exception on audio.play()
Call to audio.play() from mhttpd_alarm_play() bombs with an exception (google-chrome):
message: "play() failed because the user didn't interact with the document first. https://goo.gl/xX8pDD"
name: "NotAllowedError"
The explanation URL resolves to this: https://developers.google.com/web/updates/2017/09/autoplay-policy-changes
Looks like we are a victim of the war on evil autoplaying video and audio. From reading the stuff I am not sure on what to do to ensure the midas alarm sound always plays.
K.O.
Comments (12)
-
-
reporter for the record, current midas prints this to the javascript console. Macos google-chrome “Version 77.0.3865.120”. I do not know if any sounds actually come out as I have the midas tabs muted.
'''
Sun Oct 13 2019 08:58:40 GMT-0700 (Pacific Daylight Time): mhttpd_alarm_play: Cannot play alarm sound: audio.play() exception: NotAllowedError: play() failed because the user didn't interact with the document first. https://goo.gl/xX8pDD
‘''
-
reporter “media engagement index” for MIDAS is zero (0) per chrome://media-engagement, even if I play the alarm sound 10 times by pressing “play test sound” on the “config” page. WTH. https://developers.google.com/web/updates/2017/09/autoplay-policy-changes
-
Have you tried that?
https://www.tenforums.com/tutorials/116467-allow-block-sites-play-sound-google-chrome.html
-
reporter Much moaning, but no solutions here. Half the people want a flag for autoplay permanent disable, half the people want a flag for autoplay forced-enabled so they can play alarm sounds (like we do): https://support.google.com/chrome/thread/11038196?hl=en
-
reporter Stefan - the “tenforums” instructions explain how to use the “mute” function. That is not what I am looking at. What I am looking at is the auto.play() promise rejection due to “user did not interact with site”, (and the alarm sound is not played, the best I can tell).
To give you a taste of the problem, google docs say that muted tabs should “play” all audio, but that is not what I see with my eyes: in a muted tab, I see auto.play() rejected promise, too.
I have no idea if audio.play() promises are rejected or not or if audio plays or not in unmuted tabs. To test this, I have to unmute my “midas site” (using the instructions from “tenforums”), then turn off my laptop speakers (I do not want midas alarm sounds at 2am) and then wait like this for 2 weeks for the google-chrome to decide that “user did not interact with the site”. I use the laptop every day, I cannot turn off all audio for 2 weeks.
K.O.
-
reporter It looks like one can force the missing flag #autoplay-policy from the command line: https://stackoverflow.com/questions/57455849/chrome-autoplay-policy-chrome-76
They suggest this:
google-chrome-stable --kiosk http://google.com/ --new-window --start-maximized --incognito --autoplay-policy=no-user-gesture-required --disable-features=PreloadMediaEngagementData,AutoplayIgnoreWebAudio,MediaEngagementBypassAutoplayPolicies &
But it is not clear how to enable this just for the midas web pages, not globally (for all and every web page).
K.O.
-
reporter There is also this, (have no idea how to use it)
https://cloud.google.com/docs/chrome-enterprise/policies/?policy=AutoplayWhitelist
and
https://cloud.google.com/docs/chrome-enterprise/policies/?policy=AutoplayAllowed
-
reporter Where the heck are these bogus instructions come from?!? My google-chrome does not have these flags. (They do not say what google-chrome they use that has them).
https://maryville.aloft.support/hc/en-us/articles/360013433934-Changing-Autoplay-Policy-in-Chrome
-
reporter There is this: "Consumption of the media (audio/video) must be greater than 7 seconds". The midas alarm sound is 3 sec long. Maybe this is why MEI is always zero. Should we try to make it longer? 3 sec of alarm, 4 sec of silence?
-
reporter set the alarm sound to “watch.mp3”, it is 15 sec long. Still see the MEI always zero. Maybe they only measure MEI for video objects. After all ,they are fighting auto playing video ads with obnoxious autoplaying sound. I give up on this problem for now. K.O.
-
reporter - changed status to wontfix
Do not know how to fix this. K.O.
- Log in to comment
The mentioned solution proposes to change the flag chrome://flags/#autoplay-policy, but in my chrome (77.0) I don’t see that flag. Midas alarms sound without problem. Has this flag been dropped recently? Can you try to update to 77.0 and try again?
Stefan