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

170
Visualizações
In videojs, I can add a Text Track event handler, but I can't remove it

I added a handler for the 'cuechange' event to a Text Track" This works fine. But I can not find a way to remove this handler. I tried each of instructions below to remove the handler, but it still gets called.

onHiliteSpeech() {
  const textTrack = this.videojsComponent.getTextTrack();

  const handleCueChange = () => {
   ...
   console.log(in event handler);
   }
  };

  if (this.bevents) {
    textTrack.addEventListener('cuechange', handleCueChange);
  } else {

    // none of the below instructions remove the handler.
    textTrack.removeEventListener('cuechange', handleCueChange);
    // textTrack.removeAllListeners();
    // textTrack.removeAllListeners('cuechange');
    // textTrack.eventListeners = null;
  }
}

In my videojsComponent:

getTextTrack(): TextTrack {
  return this.player.textTracks()[0];
}
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

After some trial and error, I found the problem. The function "handleCueChange" should not be a nested function within onHiliteSpeech.

I moved handleCueChange outside of onHiliteSpeech. (This also involved some work to allow handleCueChange to access some OnHiliteSpeech properties.) The new working code became:

const handleCueChange = () => {
   ...
   console.log(in event handler);
   }
};

onHiliteSpeech() {

  textTrack.addEventListener('cuechange', this.handleCueChange);
  ...
  textTrack.removeEventListener('cuechange', this.handleCueChange);
}
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