Updated PWA player

This commit is contained in:
Brian Fertig 2026-04-22 19:52:10 -06:00
parent 35f2dfbdbc
commit 6be01104cb
2 changed files with 11 additions and 1 deletions

View File

@ -38,6 +38,13 @@ if (canvas && audio) {
analyser.connect(audioCtx.destination);
hooked = true;
window.briTunesAnalyser = analyser;
// Resume the context the moment the OS suspends it mid-playback
// (screen lock on iOS/Android silences output via AudioContext suspension).
audioCtx.addEventListener('statechange', () => {
if (audioCtx.state === 'suspended' && !audio.paused) {
audioCtx.resume().catch(() => {});
}
});
} catch (err) {
console.warn('[player-viz] could not hook audio:', err.message);
}
@ -58,6 +65,9 @@ if (canvas && audio) {
document.addEventListener('visibilitychange', () => {
visible = !document.hidden;
if (!document.hidden && audioCtx && audioCtx.state === 'suspended' && !audio.paused) {
audioCtx.resume().catch(() => {});
}
});
function frame() {

View File

@ -1,4 +1,4 @@
const CACHE = 'bri-tunes-v7';
const CACHE = 'bri-tunes-v8';
const STATIC_PRECACHE = [
'/',
'/static/css/app.css',