Back to Content

VideoFrame: clone() method

files/en-us/web/api/videoframe/clone/index.md

latest755 B
Original Source

{{APIRef("Web Codecs API")}}{{AvailableInWorkers("window_and_dedicated")}}

The clone() method of the {{domxref("VideoFrame")}} interface creates a new VideoFrame object referencing the same media resource as the original.

Syntax

js-nolint
clone()

Parameters

None.

Return value

A new cloned {{domxref("VideoFrame")}} object.

Exceptions

  • InvalidStateError {{domxref("DOMException")}}
    • : Thrown if the VideoFrame object has been transferred.

Examples

The following example clones a copy of VideoFrame as videoFrame2.

js
let videoFrame2 = VideoFrame.clone();

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}