GoogleChromeLabs / airhorn

Air horn
https://airhorner.com/
Other
365 stars 188 forks source link

Fix WebAudio playback due to autoplay policy changes #37

Closed beaufortfrancois closed 6 years ago

beaufortfrancois commented 6 years ago

Due to upcoming Autoplay policy changes, an AudioContext must be created or resumed after the document received a user gesture to enable audio playback.

More at https://webaudio.github.io/web-audio-api/#dfn-allowed-to-start

/me excited to contribute to this essential PWA ;)

PaulKinlan commented 6 years ago

thank you

AdrianJagodznski commented 6 years ago

Can you fix this?

The Web Audio autoplay policy will be re-enabled in Chrome 70 (October 2018). Please check that your website is compatible with it. https://goo.gl/7K7WLu _ @ howler.core.min.js?v=7ed9cd42da:2 init @ howler.core.min.js?v=7ed9cd42da:2 o @ howler.core.min.js?v=7ed9cd42da:2 (anonymous) @ root_framework.js.eff0f9a9c6760d3af9e5655dad9a9906.js?v=7ed9cd42da:838 createModule @ root_library.js.df4bbad334f2141f77417cb64963a856.js?v=7ed9cd42da:34 (anonymous) @ root_framework.js.eff0f9a9c6760d3af9e5655dad9a9906.js?v=7ed9cd42da:838 (anonymous) @ root_framework.js.eff0f9a9c6760d3af9e5655dad9a9906.js?v=7ed9cd42da:842

howler.core.min.zip

KyleSanderson commented 5 years ago

@beaufortfrancois you've destroyed background audio playing in atleast all https://github.com/ValveSoftware games. Can you please revert this or come up with a suitable way to play music in the background for people using CEF?

KyleSanderson commented 5 years ago

https://ice.plaguefest.com/radio.html for an example (check out JS).

    RegAdminCmd("sm_djrst", OnResetStreamAll, ADMFLAG_ROOT, "DJ made a mistake, save themselves.");
    RegAdminCmd("sm_djs", OnStreamStats, ADMFLAG_ROOT, "Stream Stats.");
    RegConsoleCmd("sm_djr", OnResetStream, "Reset the stream.");
    RegConsoleCmd("sm_djf", OnForgetDJ, "Toggles Eligibility of Radio.");
    RegConsoleCmd("sm_djv", OnDJVolume, "Increases or Decreases the volume of the Radio.");
    RegConsoleCmd("sm_djt", OnDJTrack, "Prints the Present Track.");
textfiles commented 5 years ago

Anybody who is coming late into this would do well to see the original announcement and the tidal wave of reaction to this poor approach, followed by what is apparently 8 months of waiting for the furor to die down and then re-introduce it:

https://developers.google.com/web/updates/2017/09/autoplay-policy-changes

woodydeck commented 5 years ago

I wasn't aware of this issue until developing a game in Phaser. Then I read about media engagement indexes from the link in the console log. This was the straw that broke the camel's back. Chrome is uninstalled for me, and I will not support the browser as an independent developer.

This issue is analogous to social credit scoring in China, which I'm certain someone google related had a hand in implementing. Sad.

KyleSanderson commented 5 years ago

@woodydeck yeah; I actually lost a friend over this ( @psychonic ). I'm using a couple 0days now as @nephyrin and @kisak-valve really don't give a shit as TF and similar are end of life. Honestly the entire thing is tragic but all you can do is hope for the future (and that clients don't crash when you're running shell code; Linux is ironically a nightmare).

Tectract commented 5 years ago

No idea what I'm looking at. I got here because of this bug:

The AudioContext was not allowed to start. It must be resumed (or created) after a user gesture on the page. https://goo.gl/7K7WLu

How do I re-enable audio, or bypass/fix this bug? My application plays audio to ALERT people to look at the page, not in response to any user action.

optionj85 commented 4 years ago

I have a web application that is browsed-to by plugins for OBS and XSplit live-streaming software. My application allows the user to assign sounds to play at a specific time after the page is loaded. This is by design and configurable by my customers - in addition, the customer is the only person that will be viewing the page directly. The web application is by no means similar to the browsing experience that this policy has been put in place to protect. What should people in my situation do about this?

Tectract commented 4 years ago

Good luck, it's totally broken. In their attempt to block "autoplay" video, browser devs completely messed up sound for millions of sites. All mainstream media sites still autoplay video using shady hacks now. Isn't this better?

CarlBinneman commented 4 years ago

So... Dicks to everyone working in web development?

xgqfrms commented 1 year ago

📝 still no way to autoplay audio with sound, even if it is muted.

outdated solutions

https://stackoverflow.com/questions/50490304/how-to-make-audio-autoplay-on-chrome