files/en-us/web/api/rtcpeerconnection/removestream_event/index.md
{{APIRef("WebRTC")}}{{Deprecated_Header}}{{Non-standard_Header}}
The obsolete removestream event was sent to an {{domxref("RTCPeerConnection")}} to inform it that a {{domxref("MediaStream")}} had been removed from the connection.
You can use the RTCPeerConnection interface's onremovestream property to set a handler for this event.
This is the counterpart to the {{domxref("RTCPeerConnection.addstream_event", "addstream")}} event, which is also obsolete.
[!WARNING] This event has been removed from the WebRTC specification in favor of the existing {{DOMxRef("MediaStream/removetrack_event", "removetrack")}} event on the remote {{domxref("MediaStream")}} and the corresponding event handler property of the remote {{domxref("MediaStream")}}. The {{domxref("RTCPeerConnection")}} API is now track-based, so having zero tracks in the remote stream is equivalent to the remote stream being removed, which caused a
removestreamevent.
This event is not cancelable and does not bubble.
Use the event name in methods like {{domxref("EventTarget.addEventListener", "addEventListener()")}}, or set an event handler property.
addEventListener("removestream", (event) => { })
onremovestream = (event) => { }
A {{domxref("MediaStreamEvent")}}. Inherits from {{domxref("Event")}}.
{{InheritanceDiagram("MediaStreamEvent")}}
A {{domxref("MediaStreamEvent")}} being an {{domxref("Event")}}, this event also implements these properties.
{{Compat}}