aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--templates/index.html13
1 files changed, 11 insertions, 2 deletions
diff --git a/templates/index.html b/templates/index.html
index 49ea270..82adc42 100644
--- a/templates/index.html
+++ b/templates/index.html
@@ -396,9 +396,16 @@
updateNowPlaying();
setInterval(updateNowPlaying, 8000);
- // resume audio context on gesture
+
document.addEventListener('click', function once(){
- try { if (window.AudioContext && window.AudioContext.prototype.resume) window.AudioContext.prototype.resume(); } catch(_) {}
+ try {
+ const actx = window.__ytRadioAudioContext;
+ if (actx && typeof actx.resume === 'function') {
+ actx.resume().catch(()=>{});
+ } else {
+ audio.play().catch(()=>{});
+ }
+ } catch(_) {}
document.removeEventListener('click', once);
});
@@ -407,6 +414,8 @@
const AudioCtx = window.AudioContext || window.webkitAudioContext;
if (!AudioCtx) { canvas.style.display='none'; return; }
const actx = new AudioCtx();
+ // expose the AudioContext instance so the gesture handler can resume it
+ try { window.__ytRadioAudioContext = actx; } catch(e) {}
let src;
try { src = actx.createMediaElementSource(audio); }
catch(e) { canvas.style.display='none'; return; }
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage