AudioNode: thuộc tính context

Baseline Widely available

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

Thuộc tính chỉ đọc context của giao diện AudioNode trả về BaseAudioContext liên kết, tức đối tượng biểu diễn đồ thị xử lý mà nút này đang tham gia.

Giá trị

Đối tượng AudioContext hoặc OfflineAudioContext đã được dùng để tạo AudioNode này.

Ví dụ

js
const audioCtx = new AudioContext();

const oscillator = audioCtx.createOscillator();
const gainNode = audioCtx.createGain();
oscillator.connect(gainNode).connect(audioCtx.destination);

console.log(oscillator.context); // AudioContext
console.log(oscillator.context === audioCtx); // true

Thông số kỹ thuật

Specification
Web Audio API
# dom-audionode-context

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

Xem thêm