MediaStream.clone() creates a duplicate of the stream. Per MDN, the copy has a new unique id and contains clones of every MediaStreamTrack — not the same track objects.
Pass the required arguments shown below. Check return values and browser support before you rely on the result.
Syntax
Call stream.clone. Start with this line.
JavaScript
mediaStream.clone()
Call
What it does
mediaStream.clone()
Primary signature.
stream.clone(...)
Call with the arguments your case needs.
Built into the browser. Call clone(...) on a MediaStream — no import required.
Library declarations
JavaScript
mediaStream.clone()
Parameters
This member has no parameters beyond those shown in the signature.
Return Value
Return Value
Description
*
New MediaStream with cloned tracks
JavaScript Examples
Example 1 — Basic clone()
Duplicate a canvas stream and compare object identity.
Ids still differ. Each stream gets its own unique id.
Compatibility
Browser Support
MediaStream.clone() is Baseline Widely available (MDN: since September 2017). It is part of the Media Capture and Streams specification. It is a browser Web API — not available in Node.js, Bun, or Deno.
✓ Baseline · Widely available
MediaStream.clone()
Supported across modern Chrome, Firefox, Safari, and Edge for duplicating media streams.
98%Browser support
Google ChromeSupported · Desktop & Mobile
Full support
Mozilla FirefoxSupported · Desktop & Mobile
Full support
Apple SafariSupported · macOS & iOS
Full support
Microsoft EdgeSupported · Chromium
Full support
Internet ExplorerNo native support · Use a polyfill
Polyfill
OperaSupported · Modern versions
Full support
Samsung InternetSupported · Android
Full support
Android WebViewSupported · Modern WebView
Full support
clone()Excellent
Bottom line: Browser only — not a Node.js API. Safe for production. Use clone() when you need a new stream id and independent track objects.
Frequently Asked Questions
clone() creates a duplicate MediaStream. The new stream has a new unique id and contains clones of every MediaStreamTrack from the original — not the same track objects.
No. MDN marks MediaStream.clone() as Baseline Widely available (since September 2017). It is not Deprecated, Experimental, or Non-standard.
No. Call it on an existing MediaStream with no arguments: stream.clone().
new MediaStream(other) shares the same track references. clone() returns a new stream whose tracks are independent clones.
Yes. MDN says the new MediaStream has a new unique id.
A new MediaStream instance with cloned tracks. The original stream is unchanged.