TextTrack Class

https://html.spec.whatwg.org/multipage/media.html#texttrack

public sealed class TextTrack : EventTarget
Inheritance
EventTarget TextTrack

Properties

NameDescription
ActiveCuesGets the cues of the track that are active (the current playback position of the media element is in their range), in text track cue order (https://html.spec.whatwg.org/multipage/media.html#dom-texttrack-activecues), or null when the track is disabled. The list is live.
CuesGets the cues of the track, in text track cue order (https://html.spec.whatwg.org/multipage/media.html#dom-texttrack-cues), or null when the track is disabled. The list is live.
IdGets the identifier of the track (https://html.spec.whatwg.org/multipage/media.html#dom-texttrack-id): the id attribute of its track element, the identifier of a track of the media resource, or an empty string.
InBandMetadataTrackDispatchTypeGets the in-band metadata track dispatch type of a metadata track of the media resource, or an empty string.
KindGets the kind of the track (https://html.spec.whatwg.org/multipage/media.html#dom-texttrack-kind).
LabelGets the label of the track, or an empty string (https://html.spec.whatwg.org/multipage/media.html#dom-texttrack-label).
LanguageGets the language of the track (a BCP 47 language tag), or an empty string (https://html.spec.whatwg.org/multipage/media.html#dom-texttrack-language).
ModeGets or sets the mode of the track (https://html.spec.whatwg.org/multipage/media.html#dom-texttrack-mode). A track whose mode is not TextTrackMode.Disabled obtains the cues of its track element; a change event is fired at the list of text tracks of the media element when the mode changes.
OnCueChangeGets or sets the event handler of the cuechange event.
SourceBufferGets the source buffer that created the track (https://w3c.github.io/media-source/#dom-texttrack-sourcebuffer): always null (the text tracks of the byte streams of the Media Source Extensions are not supported).

ActiveCues

TextTracks.cs

Gets the cues of the track that are active (the current playback position of the media element is in their range), in text track cue order (https://html.spec.whatwg.org/multipage/media.html#dom-texttrack-activecues), or null when the track is disabled. The list is live.

public TextTrackCueList? ActiveCues { get; }

Gets the cues of the track, in text track cue order (https://html.spec.whatwg.org/multipage/media.html#dom-texttrack-cues), or null when the track is disabled. The list is live.

public TextTrackCueList? Cues { get; }

Gets the identifier of the track (https://html.spec.whatwg.org/multipage/media.html#dom-texttrack-id): the id attribute of its track element, the identifier of a track of the media resource, or an empty string.

public string Id { get; }

InBandMetadataTrackDispatchType

TextTracks.cs

Gets the in-band metadata track dispatch type of a metadata track of the media resource, or an empty string.

public string InBandMetadataTrackDispatchType { get; }

Gets the kind of the track (https://html.spec.whatwg.org/multipage/media.html#dom-texttrack-kind).

public TextTrackKind Kind { get; }

Gets the label of the track, or an empty string (https://html.spec.whatwg.org/multipage/media.html#dom-texttrack-label).

public string Label { get; }

Gets the language of the track (a BCP 47 language tag), or an empty string (https://html.spec.whatwg.org/multipage/media.html#dom-texttrack-language).

public string Language { get; }

Gets or sets the mode of the track (https://html.spec.whatwg.org/multipage/media.html#dom-texttrack-mode). A track whose mode is not TextTrackMode.Disabled obtains the cues of its track element; a change event is fired at the list of text tracks of the media element when the mode changes.

public TextTrackMode Mode { get; set; }

OnCueChange

TextTracks.cs

Gets or sets the event handler of the cuechange event.

public Action<Event>? OnCueChange { get; set; }

SourceBuffer

TextTracks.cs

Gets the source buffer that created the track (https://w3c.github.io/media-source/#dom-texttrack-sourcebuffer): always null (the text tracks of the byte streams of the Media Source Extensions are not supported).

public SourceBuffer? SourceBuffer { get; }

Methods

NameDescription
AddCue(TextTrackCue)Adds a cue to the list of cues of the track (https://html.spec.whatwg.org/multipage/media.html#dom-texttrack-addcue); the cue is first removed from the track it belongs to.
RemoveCue(TextTrackCue)Removes a cue from the list of cues of the track (https://html.spec.whatwg.org/multipage/media.html#dom-texttrack-removecue).

AddCue(TextTrackCue)

TextTracks.cs

Adds a cue to the list of cues of the track (https://html.spec.whatwg.org/multipage/media.html#dom-texttrack-addcue); the cue is first removed from the track it belongs to.

public void AddCue(TextTrackCue cue)

RemoveCue(TextTrackCue)

TextTracks.cs

Removes a cue from the list of cues of the track (https://html.spec.whatwg.org/multipage/media.html#dom-texttrack-removecue).

public void RemoveCue(TextTrackCue cue)

Parameters

cue TextTrackCue

Exceptions

DomException
A NotFoundError when the cue is not in the list of cues of the track.

See also