This is an experimental technology
Because this technology's specification has not stabilized, check the compatibility table for usage in various browsers. Also note that the syntax and behavior of an experimental technology is subject to change in future versions of browsers as the specification changes.
URL.createObjectURL() static method creates a
DOMString containing an URL representing the object given in parameter. The URL lifetime is tied to the
document in the window on which it was created. The new object URL represents the specified
File object or
The use of a
MediaStream object as an input to this method is in the process of being deprecated. Discussions are ongoing about whether or not it should be removed outright. As such, you should try to avoid using this method with
MediaStreams, and should use
objectURL = URL.createObjectURL(object);
Each time you call
createObjectURL(), a new object URL is created, even if you've already created one for the same object. Each of these must be released by calling
URL.revokeObjectURL() when you no longer need them. Browsers will release these automatically when the document is unloaded; however, for optimal performance and memory usage, if there are safe times when you can explicitly unload them, you should do so. E.g. Failing to do so on URLs created from
MediaStreams may leave the browser's camera light on longer than necessary.
Note that there's no need to create URLs out of a
MediaStream, as stream objects may be assigned directly to playback elements using
HTMLMediaElement.srcObject. The ability to use a
MediaStream as the value of
object is being deprecated.
The definition of 'URL' in that specification.
|Working Draft||Initial definition.|
|Feature||Chrome||Edge||Firefox (Gecko)||Internet Explorer||Opera||Safari (WebKit)|
|Basic support||8 
|(Yes)||4.0 (2)||10||15||6 
|(Yes)||21 (21)||11||15||6 
|Feature||Chrome for Android||Android||Edge||Firefox Mobile (Gecko)||IE Phone||Opera Mobile||Safari Mobile|
|Basic support||18 ||4.0 ||(Yes)||14.0 (14)||?||15 ||6.0 |
||18 ||(Yes) ||(Yes)||14.0 (14)||?||15 ||6.0 |
URL prefixed as