The removetrack
event is fired when a new MediaStreamTrack
object has been removed from a MediaStream
.
This event is not cancelable and does not bubble.
The removetrack
event is fired when a new MediaStreamTrack
object has been removed from a MediaStream
.
This event is not cancelable and does not bubble.
Use the event name in methods like addEventListener()
, or set an event handler property.
js
addEventListener("removetrack", (event) => {}); onremovetrack = (event) => {};
A MediaStreamTrackEvent
. Inherits from Event
.
Also inherits properties from its parent interface, Event
.
MediaStreamTrackEvent.track
Read only
A MediaStreamTrack
object representing the track which was removed from the stream.
Using addEventListener()
:
js
const stream = new MediaStream(); stream.addEventListener("removetrack", (event) => { console.log(`${event.track.kind} track removed`); });
Using the onremovetrack
event handler property:
js
const stream = new MediaStream(); stream.onremovetrack = (event) => { console.log(`${event.track.kind} track removed`); };
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 |
26 | 12 | 7259–72Before Firefox 72, the event handler was exposed but had no effect. |
No | No | 11 | 4.4 | 26 | 7959–79Before Firefox 72, the event handler was exposed but had no effect. |
No | 11 | 1.5 |
addtrack
AudioTrackList
targets: removetrack
VideoTrackList
targets: removetrack
© 2005–2023 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