Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

185
Views
Usar un botón pero recibir: DOMException: play() falló porque el usuario no interactuó primero con el documento

Actualmente recibo este error en Google Chrome cuando intento ejecutar una función JS que reproduce sonido al hacer clic en un botón.

aquí está el código:

 index.html <button type="button" id="test-button">Test C Key</button>
 index.js function playNote() { let audio = new Audio('sounds/c-major.wav') audio.play() } document.getElementById('test-button').addEventListener('click', playNote())

Error:

 index.js:3 Uncaught (in promise) DOMException: play() failed because the user didn't interact with the document first.

¿Algún consejo sobre cómo superar esto? Entiendo que no se puede reproducir automáticamente, pero estoy usando un botón para activarlo.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!