Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions packages/vidstack/src/providers/video/native-hls-text-tracks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,16 @@ export class NativeHLSTextTracks {
// Skip tracks the `NativeTextRenderer` has added.
if (!nativeTrack || findTextTrackElement(this.#video, nativeTrack)) return;

// Skip tracks created by a JS playback engine. dash.js adds its text tracks via
// `addTextTrack()` (marked with `manualMode`) and the DASH provider registers them
// from `TEXT_TRACKS_ADDED`; adopting them here as well binds two `TextTrack`s to one
// native track, and the single-showing rule then oscillates against the native
// renderer sync until the call stack overflows (or the page hangs).
if ('manualMode' in nativeTrack) return;
for (const existing of this.#ctx.textTracks) {
if (existing[TextTrackSymbol.native]?.track === nativeTrack) return;
}

const track = new VdsTextTrack({
id: nativeTrack.id,
kind: nativeTrack.kind,
Expand Down