I am designing an HTML page and added an audio in the header there using the below code:
<audio id="audio_play">
<source src="voice/Story 2_A.m4a" type="audio/ogg" />
</audio>
<img class="head-icon" src="img/audio.png" onClick="document.getElementById('audio_play').play(); return false;" />
<img class="head-icon2" src="img/audio2.png" onClick="document.getElementById('audio_play').pause(); return false;" />
But now I want to autoplay the audio on page load. I am using autoplay
both on the audio tag and the source tag. But can't help. Even removed the last 2 lines of the code following this, but that too won't help.
You can check the page directly from here.
As per the code added, it is playing the audio upon clicking on the icon now. I am not sure what I am missing to make it autoplay on page load.