Editorial: merge the text track concept into TextTrack#12659
Merged
Conversation
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.
Member
Author
|
@nigelmegitt this does what you were looking for I think. |
noamr
approved these changes
Jul 8, 2026
noamr
left a comment
Contributor
There was a problem hiding this comment.
Thanks, that's much better. I thought that this indirection was a bit verbose for no reason.
|
Agree, this is much better. It's clearer semantically as well as being easier to read. |
|
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A text track is now simply a
TextTrackobject, rather than a separate concept that has a correspondingTextTrackobject. This drops an indirection layer throughout the text track API (e.g. "this's text track's mode" becomes "this's mode") and alignsTextTrackwithAudioTrackandVideoTrack, whose objects already are the track.Why the split existed: it dates back to when
addTextTrack()returned aMutableTextTrack(aTextTracksubclass). A single text track could be represented by either aTextTrackor aMutableTextTrackobject, so the concept had to be kept distinct from the concrete object.MutableTextTrackwas folded intoTextTrackin c416bd1, which left the split vestigial; this finishes that cleanup.TextTrackCuekeeps its concept/object split for now, since a text track cue can exist independently of itsTextTrackCueobject.This is a no-op for conformance: a text track and its
TextTrackobject were always created together, 1:1.Follow-up to the discussion on #12648.
/media.html ( diff )