Join the conversation

Sign in to join this conversation, and others like it, in the communities you care about.

Frontend Hub

Talk anything related Frontend development, HTML/CSS, client side Javascript, Bootstrap, etc

Frontend Hub / General

Audio auto play not working

Audio auto play not working

Frontend Hub / General · March 17, 2020 at 8:39am

I used below code but it is not playing automatically, I am understand why it is not working. Please help me some.

<audio controls autoplay> <source src="horse.ogg" type="audio/ogg"> <source src="horse.mp3" type="audio/mpeg"> Your browser does not support the audio element. </audio>


March 20, 2020 at 2:16am

Not all browsers support all those tags. Some browsers do now allow autoplay. You should Google search for some other music playing code.

    like-fill
    1
    • reply
    • like

    March 31, 2020 at 10:19pm

    use modernizr for backwards compatibility and legacy codes. This will help you create a better experience for users in case of exceptions.

      like-fill
      1
      • reply
      • like

      May 18, 2021 at 7:10pm

      This happens with me once when google introduced its policy to stop autoplay music on load page, then i get a solution to make duplicate and first audio is blank with no sound and is 1 sec and then play original music which then works for me.

        • reply
        • like

        Try this trick this may help.

          • reply
          • like