Skip to content

Commit

Permalink
PLBCK-140: Fixed logic for onMediaSeeking for nullable media
Browse files Browse the repository at this point in the history
  • Loading branch information
jfconti committed Oct 7, 2024
1 parent eb51883 commit 962004d
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/controller/subtitle-stream-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,11 +200,8 @@ export class SubtitleStreamController
}

onMediaSeeking() {
if (!this.media) {
return;
}
// Find the currently showing subtitle track
const tracks = this.media.textTracks;
const tracks = this.media?.textTracks || [];
let track;
for (let i = 0; i < tracks.length; i++) {
const textTrack = tracks[i];
Expand All @@ -218,7 +215,7 @@ export class SubtitleStreamController
}

// Manually reset the cues and fragments
if (track?.cues) {
if (track?.cues && this.media) {
// Clear all text track cues
Array.from(track.cues).forEach((cue) => track.removeCue(cue));

Expand Down

0 comments on commit 962004d

Please sign in to comment.