AudioEncoder: sự kiện dequeue

Limited availability

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

Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.

Note: This feature is available in Dedicated Web Workers.

Sự kiện dequeue của giao diện AudioEncoder phát ra để báo hiệu AudioEncoder.encodeQueueSize đã giảm.

Điều này loại bỏ nhu cầu để nhà phát triển phải dùng thăm dò bằng setTimeout() nhằm xác định khi nào hàng đợi đã giảm và nên đưa thêm công việc vào hàng đợi.

Cú pháp

Hãy dùng tên sự kiện trong các phương thức như addEventListener(), hoặc đặt một thuộc tính trình xử lý sự kiện.

js
addEventListener("dequeue", (event) => { })

ondequeue = (event) => { }

Ví dụ

js
audioEncoder.addEventListener("dequeue", (event) => {
  // Đưa thêm công việc mã hóa vào hàng đợi
});

Thông số kỹ thuật

Specification
WebCodecs
# eventdef-audioencoder-dequeue

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