MediaStream.stop() has been deprecated

Published: | Categories: Audio & Video

Description

The stop method on the MediaStream interface has been removed from the WebRTC specification and deprecated in Firefox 44. To stop a streaming, use the MediaStreamTrack.stop method instead as the following code snippet shows.

navigator.mediaDevices.getUserMedia({
  audio: false,
  video: true
}).then(stream => {
  // stream.stop(); // Deprecated
  stream.getVideoTracks()[0].stop(); // Recommended
});

According to the developer, there will be a couple more changes to the WebRTC implementation to comply with the latest spec. We will document any changes affecting backward compatibility.

References