AudioContext: thuộc tính baseLatency

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since April 2021.

Thuộc tính chỉ đọc baseLatency của giao diện AudioContext trả về một số thực double biểu diễn số giây độ trễ xử lý phát sinh khi AudioContext truyền một bộ đệm âm thanh từ AudioDestinationNode , tức là cuối đồ thị âm thanh, vào hệ thống con âm thanh của hệ thống máy chủ để sẵn sàng phát.

Note: Bạn có thể yêu cầu một mức độ trễ nhất định trong lúc khởi tạo bằng tùy chọn latencyHint, nhưng trình duyệt có thể bỏ qua tùy chọn này.

Giá trị

Một số thực double biểu diễn độ trễ cơ sở theo giây.

Ví dụ

js
// độ trễ mặc định ("interactive")
const audioCtx1 = new AudioContext();
console.log(audioCtx1.baseLatency); // 0.00

// độ trễ cao hơn ("playback")
const audioCtx2 = new AudioContext({ latencyHint: "playback" });
console.log(audioCtx2.baseLatency); // 0.15

Thông số kỹ thuật

Thông số kỹ thuật
Web Audio API
# dom-audiocontext-baselatency

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

Xem thêm