Table of Contents

Class VideoTrack

Namespace
CSharpToJavaScript.APIs.JS
Assembly
CSharpToJavaScript.dll

The VideoTrack interface represents a single video track from a video element.

[Value("VideoTrack")]
public class VideoTrack
Inheritance
VideoTrack
Inherited Members

Remarks

The most common use for accessing a VideoTrack object is to toggle its Selected property in order to make it the active video track for its {{HTMLElement("video")}} element.

See also on MDN

Constructors

VideoTrack()

public VideoTrack()

Properties

Id

The id property contains a
string which uniquely identifies the track represented by the
VideoTrack.

[Value("id")]
public string Id { get; }

Property Value

string

A string which identifies the track, suitable for use when calling
GetTrackById(string) on an
VideoTrackList such as the one specified by a media element's
VideoTracks property.

Remarks

This ID can be used with the
GetTrackById(string) method to locate a specific track within
the media associated with a media element.

The track ID can also be used as the fragment of a URL that loads the specific track
(if the media supports media fragments).

See also on MDN

Kind

The kind property contains a
string indicating the category of video contained in the
VideoTrack.

[Value("kind")]
public string Kind { get; }

Property Value

string

A string specifying the type of content the media represents. The
string is one of those found in Video track kind strings below.

Remarks

The kind can be used
to determine the scenarios in which specific tracks should be enabled or disabled. See
Video track kind strings for a list of the kinds available for video tracks.

See also on MDN

Label

The read-only VideoTrack
property label returns a string specifying the video
track's human-readable label, if one is available; otherwise, it returns an empty
string.

[Value("label")]
public string Label { get; }

Property Value

string

A string specifying the track's human-readable label, if one is
available in the track metadata. Otherwise, an empty string ("") is
returned.For example, a track whose Kind is
"sign" might have a label such as
"A sign-language interpretation.".

Remarks

Language

The read-only VideoTrack
property language returns a string identifying the
language used in the video track.

[Value("language")]
public string Language { get; }

Property Value

string

A string specifying the BCP 47 ({{RFC(5646)}}) format language tag of
the primary language used in the video track, or an empty string ("") if
the language is not specified or known, or if the track doesn't contain speech.For example, if the primary language used in the track is United States English, this
value would be "en-US". For Brazilian Portuguese, the value would be
"pt-BR".

Remarks

For tracks that include multiple languages
(such as a movie in English in which a few lines are spoken in other languages), this
should be the video's primary language.

See also on MDN

Selected

The VideoTrack property
selected controls whether or not a particular video
track is active.

[Value("selected")]
public bool Selected { get; set; }

Property Value

bool

The selected property is a Boolean whose value is true if the
track is active. Only a single video track can be active at any given time, so setting
this property to true for one track while another track is active will make
that other track inactive.

Remarks

SourceBuffer

The read-only VideoTrack
property sourceBuffer returns the
SourceBuffer that created the track, or null if the track was not
created by a SourceBuffer or the SourceBuffer has been
removed from the SourceBuffers attribute of its parent
media source.

[Value("sourceBuffer")]
public SourceBuffer? SourceBuffer { get; }

Property Value

SourceBuffer

A SourceBuffer or null.

Remarks