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

179
Vistas
does "onplay" have a delay?

When calling the play() function, I can see that there's a noticeable delay of 0.0~0.5 seconds before it actually starts playing.

I am facing some problems when using the following event listener

media.addEventListener(
    "play",
    function(){
        toggle_class(button[0], true);
        
        // compute animations for seekbar
        time_to_compute = media.duration - media.currentTime;
        progress.style = "transition: width linear " + time_to_compute + "s; width:100%;";
    }
);

Instead of changing the bar's position on time change, im changing it once and making it animated using a transition. The problem is that the transition starts BEFORE the video plays (0.0~0.5 seconds). This problem happens in both chrome and firefox.

Is there a javascript event for when the video actually plays?

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

0

The timeupdate event lets you know when the currentTime property changes, so you could wait to start the animation until the first timeupdate occurs. There's also the playing event that fires when the media starts playing the first time or resumes playing after being paused, so you might be able to use that.

A full list of HTMLMediaElement events can be found on MDN.


That said, I'd be very wary of an animation running in parallel with the video, they're bound to get out of sync. Instead, I'd probably use timeupdate with requestAnimationFrame to update the progress indicator.

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