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

314
Vistas
HTML5 video how do I show last video frame when seeking to end?

When I manually call:

player.currentTime = player.duration

(1) The video currentTime jumps to the end (desired and expected)

(2) The video starts playback from the start when I click play (desired and expected)

(3) The video does not update to show the last frame (undesired and unexpected)

Currently, I am having to do this:

player.currentTime = player.duration - 0.0001
player.play()

Which causes the video to jump close to the end and then resumes playback and then almost immediately stops when it hits the end, which fixes my problem in that the video now shows the last frame.

However, this feels somewhat hacky and cannot be as fast as simply just setting the current time. Is there a better fix? thanks

NOTE: the seek to end operation must support code programmatic code execution (e.g. code execution in response to a button click). I am NOT using the players built in seek/scrub bar (which works fine).

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

0

I think I found answer, in firefox setting player.currentTime = player.duration triggers "ended" event, thus video ends (no gap at end of seek bar).

But in chrome is this different, in chrome setting player.currentTime = player.duration won't trigger "ended" event and there is slight gap end of seek bar (i think this is what you were referring). Link to my test jsfiddle.

TL:DR The good old vendor issue

Also setting player.currentTime = player.duration + 99999 in chrome doesn't trigger "ended" event and seek bar still has gap at end.

So current work around for this bug is

stopButton.addEventListener('click', () => {
  player.currentTime = player.duration
  player.play() // trick for chrome
})

// to verify
player.addEventListener('ended', (e) => console.log(e.target.ended ? "ended" : "not ended"))

This code works on both firefox and chrome and results are exact same.

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