MediaStream: removetrack event

The removetrack event is fired when a new MediaStreamTrack object has been removed from a MediaStream.

Bubbles No
Cancelable No
Interface MediaStreamTrackEvent
Event handler property onremovetrack

Examples

Using addEventListener():

let stream = new MediaStream();

stream.addEventListener('removetrack', (event) => {
  console.log(`${event.track.kind} track removed`);
});

Using the onremovetrack event handler property:

let stream = new MediaStream();

stream.onremovetrack = (event) => {
  console.log(`${event.track.kind} track removed`);
};

Specifications

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
removetrack_event
Yes
12
No
No
No
Yes
Yes
Yes
No
No
Yes
Yes

See also

© 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/MediaStream/removetrack_event