Back to Content

AudioData: clone() method

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

latest750 B
Original Source

{{APIRef("WebCodecs API")}}{{AvailableInWorkers("window_and_dedicated")}}

The clone() method of the {{domxref("AudioData")}} interface creates a new AudioData object with reference to the same media resource as the original.

Syntax

js-nolint
clone()

Parameters

None.

Return value

The cloned {{domxref("AudioData")}} object.

Exceptions

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

Examples

The following example clones a copy of AudioData as audioData2.

js
let audioData2 = AudioData.clone();

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}