URL.createObjectURL() no longer accepts MediaStream as argument

Published: | Categories: Audio & Video, DOM


As of Firefox 62, the URL.createObjectURL static method no longer accepts a MediaStream object as the argument. According to the current specs, only a Blob or MediaSource object can be accepted.

The stream argument support has been deprecated since Firefox 54. Safari has already made the change, and Chrome may also follow soon.

Whenever you want to set a MediaStream object on a <video> or <audio> element, the HTMLMediaElement.prototype.srcObject property should be used instead as below:

// This no longer works
video.src = URL.createObjectURL(stream);
// Instead, do this
video.srcObject = stream;