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

Specification
Media Capture and Streams
# event-mediastream-removetrack

Browser compatibility

BCD tables only load in the browser

See also