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

172
Vistas
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 Respuestas
Responde la pregunta

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 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