locked
Unable to play audio automatically but if manually click a button, it works RRS feed

  • Question

  • User521171331 posted

    I try this example which works only when I click the button. But when I try to call the playAudio method automatically (when the page load), it doesn't work. I have commented out the code.

    I don't want it to method to be called inline in body tag though.

    My code is at http://js.findingsteve.net/sound.html

    Monday, May 6, 2019 6:47 AM

All replies

  • User283571144 posted

    Hi  ngaisteve,

    According to your description and codes, I have created a test demo on my side, it works well.

    I guess you may use chrome as the browser. As far as I know, the Chrome has the autoplay policy to disable autoplay.

    I suggest you could follow below steps to enable the autoplay when page loaded.

    First step, enter chrome://flags/#autoplay-policy in Chrome browser.

    The second step is to change Default to No user gesture is required in Autoplay policy.

    The third step, click on the "RELAUNCH NOW" below, and you're done!

    Best Regards,

    Brando

    Monday, May 6, 2019 12:47 PM