MediaStreamTrackEvent: MediaStreamTrackEvent() constructor

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since September 2017.

The MediaStreamTrackEvent() constructor returns a new MediaStreamTrackEvent object, which represents an event signaling that a MediaStreamTrack has been added to or removed from a MediaStream.

Syntax

js
new MediaStreamTrackEvent(type, options)

Parameters

type

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

options

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

track

A MediaStreamTrack object representing the track which was added to or removed from the stream.

Return value

A new MediaStreamTrackEvent object, initialized based on the provided options.

Specifications

Specification
Media Capture and Streams
# dom-mediastreamtrackevent-constructor

Browser compatibility

desktop mobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
MediaStreamTrackEvent() constructor
Chrome – Full support
Chrome 55 (Release date: 2016-12-01)
footnote Full support
Edge – Full support
Edge 12 (Release date: 2015-07-29)
footnote Full support
Firefox – Full support
Firefox 50 (Release date: 2016-11-15)
footnote Full support
Opera – Full support
Opera 42 (Release date: 2016-12-13)
footnote Full support
Safari – Full support
Safari 11 (Release date: 2017-09-19)
footnote Full support
Chrome Android – Full support
Chrome Android 55 (Release date: 2016-12-06)
footnote Full support
Firefox for Android – Full support
Firefox for Android 50 (Release date: 2016-11-15)
footnote Full support
Opera Android – Full support
Opera Android 42 (Release date: 2017-01-21)
footnote Full support
Safari on iOS – Full support
Safari on iOS 11 (Release date: 2017-09-19)
footnote Full support
Samsung Internet – Full support
Samsung Internet 6 (Release date: 2017-08-23)
footnote Full support
WebView Android – Full support
WebView Android 55 (Release date: 2016-12-06)
footnote Full support
WebView on iOS – Full support
WebView on iOS 11 (Release date: 2017-09-19)
footnote Full support

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support

See also