Skip to content

Commit

Permalink
fix: track src being removed bug
Browse files Browse the repository at this point in the history
  • Loading branch information
luwes committed Aug 7, 2024
1 parent 94210d8 commit d61d654
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions packages/playback-core/src/text-tracks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,15 @@ export function setupTextTracks(
if (!track.cues?.length) {
const trackEl = mediaEl.querySelector('track[label="thumbnails"]');
// Force a reload of the cues if they've been removed
const src = trackEl?.getAttribute('src') ?? '';
trackEl?.removeAttribute('src');
setTimeout(() => {
trackEl?.setAttribute('src', src);
}, 0);
const src = trackEl?.getAttribute('src');
// It's possible src is not set or we just removed it in a previous
// execution of this function. Prevent setting an empty src.
if (src) {
trackEl?.removeAttribute('src');
setTimeout(() => {
trackEl?.setAttribute('src', src);
}, 0);
}
}
// Force hidden mode if it's not hidden
if (track.mode !== 'hidden') {
Expand Down

0 comments on commit d61d654

Please sign in to comment.