feat: persist volume level in localStorage
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
4f152028f4
commit
4b2f277ff7
2 files changed
+3
-1
No files matched your search
+2
-1
@@ -162,7 +162,8 @@ window.addEventListener('load', () => {
|
||||
}, delay);
|
||||
});
|
||||
|
||||
S.audio.volume = 0.3;
|
||||
const _savedVol = parseInt(localStorage.getItem('ns_volume') ?? '', 10);
|
||||
setVolume(isNaN(_savedVol) ? 55 : _savedVol);
|
||||
|
||||
let _wasPlayingBeforeHide = false;
|
||||
|
||||
|
||||
@@ -765,6 +765,7 @@ export function setVolume(v) {
|
||||
if (absAudio) absAudio.volume = vol;
|
||||
document.querySelectorAll('.volume-slider-sync').forEach(el => { el.value = v; });
|
||||
if (HAS_BRIDGE) _nsBridge('setVolume', vol);
|
||||
try { localStorage.setItem('ns_volume', v); } catch (_) {}
|
||||
}
|
||||
|
||||
// ─── MEDIA SESSION ────────────────────────────────────────────────────────
|
||||
|
||||
Reference in new issue
Block a user