Getting muted audio autoplay to work on my website

Hi, I’m currently coding a website of my own and I’m having a hard time getting an audio file to autoplay while muted. As far as I understand, most browsers do allow audio files to autoplay as long as they’re muted. As is, though, the file doesn’t autoplay.
Here’s the code in question:

<audio controls loop autoplay muted id="inside">
            <source src="2022 PODCAST TT (v1 02 sept).mp3" type="audio/mp3"/>
1 Like

Hi @alexerobison

I am not sure what your problem is but you might find this mdn post useful:

The Embed Audio element

And to style it:

I hope that helps and good luck!

1 Like

Thank you! Those resources were informational for me.

I think it’s possible it might actually be an issue of the unmute button not working properly. Here’s some of my HTML:

<audio src="2022PODCASTTT(v102sept).mp3" autoplay muted id="inside" type="audio/mp3">
        <a type = "button" onclick="changeImage()" onclick="play()" class="hovertext"><img alt="Toggle audio" id="play" src="Play.png"/></a>

and my javascript

function play() {
    var audio = document.getElementById('inside'); audio.muted = !audio.muted;
1 Like

Thank you very much!

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.