Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

163
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!