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

213
Views
Sonido de cuadro A: ¿Cómo reaccionar al final del sonido?

Bucle falso, tamaño de grupo 1.

La ejecución de sound.playSound() reproduce correctamente el sonido, pero sound.isPlaying sigue siendo verdadero incluso después de que se haya reproducido el sonido completo.

Ya intenté agregar el detector de eventos 'finalizado por sonido' en la entidad, pero tampoco se activa.

Debe haber un estado apropiado en alguna parte... ¿verdad?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Puede realizar un seguimiento del estado del componente de sound escuchando el evento con sound-ended . A continuación, haga clic en el botón para reproducir un sonido, permanecerá rojo hasta que termine la pista de audio.

 <script src="https://aframe.io/releases/1.3.0/aframe.min.js"></script> <script> AFRAME.registerComponent("foo", { init: function() { const soundComp = this.el.components.sound; // grab the `sound` component // play the sound when the user clicks the button this.el.addEventListener("click", evt => { this.el.setAttribute("color", "red") // turn the button red soundComp.playSound(); // playsound }) // catch the `sound-ended` event this.el.addEventListener("sound-ended", evt => { this.el.setAttribute("color", "green") // turn it back to green }) } }) </script> <a-scene cursor="rayOrigin: mouse" raycaster="objects: a-sphere"> <a-assets> <audio id="ding" crossorigin="anonymous" src="https://gftruj.github.io/webzamples/arjs/sound/sound/Ding-sound-effect.mp3" preload="auto"></audio> </a-assets> <a-sphere position="0 1 -3" radius="0.25" color="green" sound="src: #ding; autoplay: false" foo ></a-sphere> </a-scene>

about 4 years ago · Juan Pablo Isaza Report
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!