SoundManager2 Autoplay not working. User interaction is needed

968 Views Asked by At

I want to play music when entering my web. I set the autoplay function of SM2 but I'm getting this error:

soundmanager2-nodebug-jsmin.js:38 Uncaught (in promise) DOMException: play() failed because the user didn't interact with the document first.

So I have to mute and unmute the sound to start hearing the music. How can I fix it?

2

There are 2 best solutions below

1
Agnidip On

You should only get this error on Google Chrome.

With the latest update, Google Chrome has stopped allowing the autoplay feature. You can try to use any other browser like Mozila to see if it works there. Up until now there is no solution to this problem, a user has to click something for the video or audio to start.

0
Agnidip On

It doesn't matter if its in php or html. For the last few days after chrome update till now no solution found. Google has changed its privacy policy. I myself has a website which broke after this google update.