W3cubDocs

/DOM

MediaStreamTrackEvent.constructor

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

Syntax

var trackEvent = new MediaStreamTrackEvent(type, {track: aMediaStreamTrack});

Parameters

The MediaStreamTrackEvent() constructor also inherits arguments from Event().

type
A DOMString representing the name of the type of the MediaStreamTrackEvent. It is case-sensitive and can be "addtrack" or "removetrack".
track
A MediaStreamTrack object representing the track which was added to or removed from the stream.

Return value

A new MediaStreamTrackEvent, initialized based on the provided options.

Specifications

Browser compatibilityUpdate compatibility data on GitHub

Desktop
Chrome Edge Firefox Internet Explorer Opera Safari
Basic support 55 ? 50 No 42 ?
Mobile
Android webview Chrome for Android Edge Mobile Firefox for Android Opera for Android iOS Safari Samsung Internet
Basic support 55 55 ? 50 42 ? 6.0

See also

© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrackEvent/MediaStreamTrackEvent