Updated PWA player
This commit is contained in:
parent
35f2dfbdbc
commit
6be01104cb
|
|
@ -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() {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
const CACHE = 'bri-tunes-v7';
|
||||
const CACHE = 'bri-tunes-v8';
|
||||
const STATIC_PRECACHE = [
|
||||
'/',
|
||||
'/static/css/app.css',
|
||||
|
|
|
|||
Loading…
Reference in New Issue