vod jam and earl vod.atverkackt.de
4
fork

Configure Feed

Select the types of activity you want to include in your feed.

Attempt to fix mobile audio

+17
+17
src/routes/+page.svelte
··· 99 99 let introEl: HTMLAudioElement; 100 100 let gameEl: HTMLAudioElement; 101 101 let audioUnlocked = false; 102 + let audioCtx: AudioContext | undefined; 102 103 103 104 function unlockAudio() { 104 105 if (audioUnlocked) return; ··· 106 107 // Mobile browsers ignore preload — force load on first user gesture 107 108 introEl?.load(); 108 109 gameEl?.load(); 110 + 111 + // Use Web Audio API GainNode to force volume on mobile (iOS ignores .volume) 112 + try { 113 + audioCtx = new AudioContext(); 114 + for (const el of [introEl, gameEl]) { 115 + if (!el) continue; 116 + const source = audioCtx.createMediaElementSource(el); 117 + const gain = audioCtx.createGain(); 118 + gain.gain.value = 0.6; 119 + source.connect(gain); 120 + gain.connect(audioCtx.destination); 121 + } 122 + audioCtx.resume().catch(() => {}); 123 + } catch (e) { 124 + console.warn('[vodjam] Web Audio gain setup failed:', e); 125 + } 109 126 } 110 127 111 128 function playCorrectTrack() {