The TrackEvent() constructor creates and returns a new TrackEvent object describing an event which occurred on a list of tracks (AudioTrackList, VideoTrackList, or TextTrackList).


new TrackEvent(type)
new TrackEvent(type, options)



A string with the name of the event. It is case-sensitive and browsers set it to addtrack or removetrack.

options Optional

An object that, in addition of the properties defined in Event(), can have the following properties:

track Optional

The track to which the event refers; this is null by default, but should be set to a VideoTrack, AudioTrack, or TextTrack as appropriate given the type of track.

Return value

A new TrackEvent object, initialized as described by the inputs to the constructor.


HTML Standard
# the-trackevent-interface

Browser compatibility

BCD tables only load in the browser