EncodedAudioChunk: copyTo() method

Khả dụng hạn chế

This feature is not Baseline because it does not work in some of the most widely-used browsers.

Note: This feature is available in Dedicated Web Workers.

Phương thức copyTo() của giao diện EncodedAudioChunk sao chép chunk dữ liệu âm thanh đã mã hóa.

Cú pháp

js
copyTo(destination)

Tham số

destination

Một ArrayBuffer, TypedArray, hoặc DataView mà dữ liệu có thể được sao chép vào.

Giá trị trả về

Không có (undefined).

Ví dụ

Trong ví dụ dưới đây, một EncodedAudioChunk được tạo rồi sao chép.

js
const init = {
  type: "key",
  data: audioBuffer,
  timestamp: 23000000,
  duration: 2000000,
};
const chunk = new EncodedAudioChunk(init);

chunk.copyTo(newBuffer);

Thông số kỹ thuật

Thông số kỹ thuật
WebCodecs
# dom-encodedaudiochunk-copyto

Tương thích trình duyệt