IonDen / ion.sound

JavaScript plugin for playing sounds and music in browsers
http://ionden.com/a/plugins/ion.sound/en.html
MIT License
713 stars 154 forks source link

Google autoplay policy #92

Open jstackman opened 6 years ago

jstackman commented 6 years ago

It seems that there may be an issue starting in October 2018 with Google Chrome. When running it, I am getting the following warning in Google Chrome:

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

I guess you have to do some kind of resume() thing, but I am not familiar with AudioContext().

IonDen commented 6 years ago

I see, i will investigate the issue.

But it should not affect sounds that are played by clicking buttons.

akaDJon commented 5 years ago

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 progress to solve this problem?

IonDen commented 5 years ago

@akaDJon, this can not be solved by JavaScript. This is new browser policy. To solve this you should do:

  1. Add button, call it "allow sounds"
  2. After user clicked it - play any sound
  3. Now all sounds are allowed on the page.
free6k commented 5 years ago

@IonDen can you add example to docs like this add with true-way? Thanks