music box fixes

This commit is contained in:
Jakub Zych
2026-04-29 22:57:12 +02:00
parent a200fb8548
commit 579e4984c2
7 changed files with 36 additions and 25 deletions

View File

@@ -503,10 +503,10 @@ body {
function renderMusicState(s) {
if (!npLine) ensureNowPlayingLine();
if (lastTrackIndex !== null && s.index !== lastTrackIndex) {
if (lastTrackFile !== null && s.file && s.file !== lastTrackFile) {
logBeforeNp(`[audio] next: ${s.title || '?'}`);
}
lastTrackIndex = s.index;
if (s.file) lastTrackFile = s.file;
npLine.querySelector('.np-title').textContent = s.title || '—';
npLine.querySelector('.np-time').textContent =
`[${fmtClock(s.currentTime)} / ${fmtClock(s.duration)}]`;
@@ -533,7 +533,8 @@ body {
if (pendingState) renderMusicState(pendingState);
}
let lastTrackIndex = null;
// Dedupe by file URI — see music-box/index.html for the rationale.
let lastTrackFile = null;
async function connectMusic() {
if (!window.__OBSWS) {
logBeforeNp('[audio] vendor/obs-config.js missing — run scripts/setup.sh', 'term-dim');