Extract the shared realtime audio graph owner
This commit is contained in:
@@ -5507,7 +5507,7 @@ const EQ_PRESETS = EqParameters.presets;
|
||||
const EQ = (() => {
|
||||
const isIOS = /iPad|iPhone|iPod/.test(navigator.userAgent) || (navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1);
|
||||
const AC = window.AudioContext || window.webkitAudioContext;
|
||||
const st = { ctx: null, filters: null, sources: new Map() };
|
||||
const st = { ctx: null, filters: null };
|
||||
// Web Audio is off on iOS (it silences playback when the screen locks)
|
||||
// unless the user opted in through "Level volume" (Settings → Playback).
|
||||
// Live Web Audio is off on iOS (it silences playback when the screen locks)
|
||||
@@ -5529,7 +5529,7 @@ const EQ = (() => {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
st.ctx = new AC();
|
||||
st.ctx = AudioGraph.context();
|
||||
st.filters = EQ_BANDS.map((b) => {
|
||||
const f = st.ctx.createBiquadFilter();
|
||||
f.type = b.type;
|
||||
@@ -5554,11 +5554,9 @@ const EQ = (() => {
|
||||
}
|
||||
|
||||
function attach(el) {
|
||||
if (!el || st.sources.has(el)) return;
|
||||
if (!el) return;
|
||||
try {
|
||||
const src = st.ctx.createMediaElementSource(el);
|
||||
src.connect(st.filters[0]);
|
||||
st.sources.set(el, src);
|
||||
AudioGraph.connect(el, st.filters[0]);
|
||||
} catch { /* already connected elsewhere */ }
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user