Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

113
Visualizações
Autoplay audio not working on any browser

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.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Audio/Video has been restricted from autoplaying. They can play only with user interaction. Also please keep the format of the audio file as ogg instead of m4a as you have specified the type as audio/ogg. Change from voice/Story 2_A.m4a to voice/something.ogg

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda