| 77 | const MEDIA_MUTED_KEY = 'frMediaMuted'; |
| 78 | |
| 79 | function loadSavedMediaVolume(el) { |
| 80 | if (!el) return; |
| 81 | try { |
| 82 | const v = localStorage.getItem(MEDIA_VOLUME_KEY); |
| 83 | if (v !== null) { |
| 84 | const vol = parseFloat(v); |
| 85 | if (!Number.isNaN(vol)) { |
| 86 | el.volume = Math.max(0, Math.min(1, vol)); |
| 87 | } |
| 88 | } |
| 89 | const m = localStorage.getItem(MEDIA_MUTED_KEY); |
| 90 | if (m !== null) { |
| 91 | el.muted = (m === '1'); |
| 92 | } |
| 93 | } catch (e) { |
| 94 | // ignore storage errors |
| 95 | } |
| 96 | } |
| 97 | |
| 98 | function attachVolumePersistence(el) { |
| 99 | if (!el) return; |