MDN self-hosted library · e01.org

MediaStreamEvent

WebRTC

WebRTC

The MediaStreamEvent interface represents events that occurs in relation to a MediaStream. Two events of this type can be thrown: addstream and removestream.

Constructors

  • MediaStreamEvent()
  • : Returns a new MediaStreamEvent. It takes two parameters, the first being a string representing the type of the event; the second a dictionary containing the MediaStream it refers to.

Instance properties

A MediaStreamEvent being an Event, this event also implements these properties.

  • MediaStreamEvent.stream
  • : Contains the MediaStream containing the stream associated with the event.

Instance methods

A MediaStreamEvent being an Event, this event also implements these properties. There is no specific MediaStreamEvent method.

Examples

pc.onaddstream = (ev) => {
  alert(`A stream (id: '${ev.stream.id}') has been added to this connection.`);
};

Browser compatibility

See also

  • WebRTC
  • Its usual target: RTCPeerConnection.