TrackEvent()
The TrackEvent() constructor creates and returns a new TrackEvent object describing an event which occurred on a list of tracks (AudioTrackList, VideoTrackList, or TextTrackList).
Syntax
trackEvent = new TrackEvent(type, eventInfo);
Parameters
type-
The type of track event which is described by the object:
"addtrack"or"removetrack". -
eventInfoOptional -
An optional dictionary providing additional information configuring the new event; it can contain the following fields in any combination:
-
trackOptional -
The track to which the event refers; this is
nullby default, but should be set to aVideoTrack,AudioTrack, orTextTrackas appropriate given the type of track. -
bubblesOptional -
A Boolean indicating whether the event bubbles or not.
-
cancelableOptional -
A Boolean indicating whether or not the event can be canceled.
-
composedOptional -
A Boolean indicating whether or not the event will trigger listeners outside of a shadow root; see
Event.composedfor more details.
-
Return value
A newly-created TrackEvent object, initialized as described by the inputs to the constructor.
Specifications
| Specification |
|---|
| HTML Standard (HTML) # the-trackevent-interface |
Browser compatibility
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
TrackEvent |
23 |
14 |
31 |
No |
15 |
6 |
≤37 |
25 |
31 |
14 |
6 |
1.5 |
© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/TrackEvent/TrackEvent