files/en-us/web/api/mediastreamevent/index.md
{{APIRef("WebRTC")}}{{Deprecated_Header}}{{Non-standard_Header}}
The MediaStreamEvent interface represents events that occurs in relation to a {{domxref("MediaStream")}}. Two events of this type can be thrown: {{domxref("RTCPeerConnection.addstream_event", "addstream")}} and {{domxref("RTCPeerConnection.removestream_event", "removestream")}}.
A MediaStreamEvent being an {{domxref("Event")}}, this event also implements these properties.
MediaStreamEvent. It takes two parameters, the first being a string representing the type of the event; the second a dictionary containing the {{domxref("MediaStream")}} it refers to.A MediaStreamEvent being an {{domxref("Event")}}, this event also implements these properties. There is no specific MediaStreamEvent method.
pc.onaddstream = (ev) => {
alert(`A stream (id: '${ev.stream.id}') has been added to this connection.`);
};
{{Compat}}