Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

541
Vistas
JavaScript play() bug in Safari 15

I want to use the HTMLMediaElement.play() method to play a sound when a button is clicked. Everything working fine in Chrome and Firefox, but Safari 15... Every time I click the button there is some kind of delay or it is not even played. I used the code as described below:

const mainButton = document.getElementById('main-button');
const buttonSound = new Audio (button-sound.mp3);

mainButton.addEventListener('click', e => {
  buttonSound.play();
});

It would be great if someone could help!

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I have not tried it yet, but this seems like a viable solution: https://browserhow.com/how-to-allow-or-block-auto-play-sound-access-in-safari-mac/ it sounds like it is disabled by default in the browser so if you enable it, it should then play. If it is delayed, does the sound file start from 0 seconds? I know that sounds obvious but that could be a reason for the delay.

This can be changed I believe by going into the safari settings specifically the article indicates to do this as follows:

  1. Launch the Safari app on a mac computer.
  2. Select Safari from the menubar options.
  3. Choose Preferences… option under the Safari menu.
  4. Switch to the Websites tab within the Preferences popup window.
  5. Choose the Auto-Play in the sidebar.
  6. At the bottom of the drop-down — When visiting other websites select Allow All Auto-Play.

enter image description here

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda