Table of Contents

Class VideoTrackList

Namespace
CSharpToJavaScript.APIs.JS
Assembly
CSharpToJavaScript.dll

The VideoTrackList interface is used to represent a list of the video tracks contained within a {{HTMLElement("video")}} element, with each track represented by a separate VideoTrack object in the list.

[Value("VideoTrackList")]
public class VideoTrackList : EventTarget
Inheritance
VideoTrackList
Inherited Members

Remarks

Retrieve an instance of this object with 'HTMLMediaElement.VideoTracks'. The individual tracks can be accessed using array syntax or functions such as {{jsxref("Array.forEach", "forEach()")}} for example.

See also on MDN

Constructors

VideoTrackList()

public VideoTrackList()

Properties

Length

The read-only VideoTrackList
property length returns the number of entries in the
VideoTrackList, each of which is a VideoTrack representing
one video track in the media element.

[Value("length")]
public ulong Length { get; }

Property Value

ulong

A number indicating how many video tracks are included in the
VideoTrackList. Each track can be accessed by treating the
VideoTrackList as an array of objects of type VideoTrack.

Remarks

A value of 0 indicates that there are no
video tracks in the media.

See also on MDN

Onaddtrack

[Value("onaddtrack")]
public EventHandlerNonNull Onaddtrack { get; set; }

Property Value

EventHandlerNonNull

Onchange

[Value("onchange")]
public EventHandlerNonNull Onchange { get; set; }

Property Value

EventHandlerNonNull

Onremovetrack

[Value("onremovetrack")]
public EventHandlerNonNull Onremovetrack { get; set; }

Property Value

EventHandlerNonNull

SelectedIndex

The read-only VideoTrackList
property selectedIndex returns the index of the
currently selected track, if any, or -1 otherwise.

[Value("selectedIndex")]
public long SelectedIndex { get; }

Property Value

long

A number indicating the index of the currently selected track, if any, or
-1 otherwise.

Remarks

Methods

GetTrackById(string)

The VideoTrackList method
getTrackById() returns the first
VideoTrack object from the track list whose Id matches the specified string.

[Value("getTrackById")]
public VideoTrack? GetTrackById(string id)

Parameters

id string

Returns

VideoTrack

A VideoTrack object indicating the first track found within the
VideoTrackList whose id matches the specified string. If no
match is found, this method returns null.The tracks are searched in their natural order; that is, in the order defined by the
media resource itself, or, if the resource doesn't define an order, the relative order
in which the tracks are declared by the media resource.

Remarks

This lets you find a specified track if
you know its ID string.

See also on MDN