Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

100
Visualizações
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 Respostas
Responde à pergunta

0

try to use >= instead of ==

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda