---
title: MediaStream.clone()
slug: Web/API/MediaStream/clone
translation_of: Web/API/MediaStream/clone
---
<p>{{APIRef("Media Capture and Streams")}}</p>

<p>The <strong><code>clone()</code></strong> method of the {{domxref("MediaStream")}} interface creates a duplicate of the <code>MediaStream</code>. This new <code>MediaStream</code> object has a new unique {{domxref("MediaStream.id", "id")}} and contains clones of every {{domxref("MediaStreamTrack")}} contained by the <code>MediaStream</code> on which <code>clone()</code> was called.</p>

<h2 id="Syntax">Syntax</h2>

<pre class="syntaxbox">var <em>stream</em> = <em>MediaStream</em>.clone();</pre>

<h3 id="Parameters">Parameters</h3>

<p>None.</p>

<h3 id="Return_value">Return value</h3>

<p>A new {{domxref("MediaStream")}} instance which has a new unique ID and contains clones of every {{domxref("MediaStreamTrack")}} contained by the <code>MediaStream</code> on which <code>clone()</code> was called.</p>

<h2 id="Specifications">Specifications</h2>

<table class="standard-table">
 <tbody>
  <tr>
   <th scope="col">Specification</th>
   <th scope="col">Status</th>
   <th scope="col">Comment</th>
  </tr>
  <tr>
   <td>{{SpecName('Media Capture', '#widl-MediaStream-clone-MediaStream', 'MediaStream.clone()')}}</td>
   <td>{{Spec2('Media Capture')}}</td>
   <td>Initial definition.</td>
  </tr>
 </tbody>
</table>

<h2 id="Browser_compatibility">Browser compatibility</h2>



<p>{{Compat("api.MediaStream.clone")}}</p>