Skip to content

Editorial: merge the text track concept into TextTrack#12659

Merged
annevk merged 1 commit into
mainfrom
annevk/merge-texttrack-concept
Jul 8, 2026
Merged

Editorial: merge the text track concept into TextTrack#12659
annevk merged 1 commit into
mainfrom
annevk/merge-texttrack-concept

Conversation

@annevk

@annevk annevk commented Jul 8, 2026

Copy link
Copy Markdown
Member

A text track is now simply a TextTrack object, rather than a separate concept that has a corresponding TextTrack object. This drops an indirection layer throughout the text track API (e.g. "this's text track's mode" becomes "this's mode") and aligns TextTrack with AudioTrack and VideoTrack, whose objects already are the track.

Why the split existed: it dates back to when addTextTrack() returned a MutableTextTrack (a TextTrack subclass). A single text track could be represented by either a TextTrack or a MutableTextTrack object, so the concept had to be kept distinct from the concrete object. MutableTextTrack was folded into TextTrack in c416bd1, which left the split vestigial; this finishes that cleanup.

TextTrackCue keeps its concept/object split for now, since a text track cue can exist independently of its TextTrackCue object.

This is a no-op for conformance: a text track and its TextTrack object were always created together, 1:1.

Follow-up to the discussion on #12648.


/media.html ( diff )

A text track is now simply a TextTrack object, rather than a separate
concept that has a corresponding TextTrack object. This drops an
indirection layer throughout the text track API (e.g. "this's text
track's mode" becomes "this's mode") and aligns TextTrack with
AudioTrack and VideoTrack, whose objects already are the track.

The split dates back to when addTextTrack() returned a MutableTextTrack,
a TextTrack subclass: a single text track could be represented by either
a TextTrack or a MutableTextTrack object, so the concept had to be kept
distinct from the concrete object. MutableTextTrack was folded into
TextTrack in commit c416bd1, which left the split vestigial; this
finishes that cleanup.

TextTrackCue keeps its concept/object split for now, since a text track
cue can exist independently of its TextTrackCue object.
@annevk

annevk commented Jul 8, 2026

Copy link
Copy Markdown
Member Author

@nigelmegitt this does what you were looking for I think.

@annevk
annevk requested a review from noamr July 8, 2026 12:39

@noamr noamr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, that's much better. I thought that this indirection was a bit verbose for no reason.

@nigelmegitt

Copy link
Copy Markdown

Agree, this is much better. It's clearer semantically as well as being easier to read.

@nigelmegitt

Copy link
Copy Markdown

By the way, I don't have permission to Approve this PR - I guess I would do if I were added to the "request a review" list.

@annevk
annevk merged commit e80d002 into main Jul 8, 2026
2 checks passed
@annevk
annevk deleted the annevk/merge-texttrack-concept branch July 8, 2026 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

3 participants