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

101
Vistas
Stop video automatically when certain time is set typescript

I'm trying to limit video play within range of number that user specified.

User specified a start frame and an end frame like this.

frameInputEnd: 300
frameInputStart: 50

i recalculate those input into seconds like this

this.startDuration = (((1000 / this.fpsCount) * this.rangeFrame.frameInputStart) / 1000).toFixed(2);
this.endDuration = ((1000 / this.fpsCount) * this.rangeFrame.frameInputEnd) / 1000;

and set the currentTime = this.startDuration. That way user can have duration start on the frame which they have specified. I want to add an event where the video has reach the currentTime that is equal to frameInputEnd here's what i did

this.videoPlayer.nativeElement.ontimeupdate = (e: any) => {
  this.whatFps = `${Math.ceil(e.target.currentTime * this.fpsCount)} / ${this.totalFrame}`;
  if(this.videoPlayer.nativeElement.currentTime.toFixed(2) == Number(this.endDuration).toFixed(2)){
    this.pause()
  }
}

i add .toFixed(2) since the frameInputEnd is equal to 12.50 seconds. but the currentTime never match to 12.50 seconds, either it's 12.51 or 12.52 the video never stopped automatically.

Does anyone knows a batter way to achieve this?

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

0

try to use >= instead of ==

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