fix: auto-play audio when jumping to a loud section

seekToSection and jumpToDaySection were only seeking (setting currentTime)
but never calling play(), so the player would open and position correctly
but stay paused. The loadedmetadata-deferred path already handles slow audio
loading; play() is now called there too.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-02 22:28:20 +02:00
parent d3ded71873
commit af8113ba03
+2 -2
View File
@@ -876,7 +876,7 @@ function seekToSection(idx, filename, startSec, endSec, sectionIdx) {
activePlayerIdx = idx; activePlayerIdx = idx;
const audio = document.getElementById('aud-'+idx); const audio = document.getElementById('aud-'+idx);
const seekTo = Math.max(0, startSec - getPreroll()); const seekTo = Math.max(0, startSec - getPreroll());
const doSeek = () => { audio.currentTime = seekTo; }; const doSeek = () => { audio.currentTime = seekTo; audio.play().catch(() => {}); };
if (audio.readyState >= 1) doSeek(); if (audio.readyState >= 1) doSeek();
else audio.addEventListener('loadedmetadata', doSeek, {once: true}); else audio.addEventListener('loadedmetadata', doSeek, {once: true});
setCutFields(idx, startSec, endSec); setCutFields(idx, startSec, endSec);
@@ -1449,7 +1449,7 @@ function jumpToDaySection(si) {
const audio = document.getElementById('aud-' + fileIdx); const audio = document.getElementById('aud-' + fileIdx);
if (!audio) return; if (!audio) return;
const seekTo = Math.max(0, start - getPreroll()); const seekTo = Math.max(0, start - getPreroll());
const doSeek = () => { audio.currentTime = seekTo; }; const doSeek = () => { audio.currentTime = seekTo; audio.play().catch(() => {}); };
if (audio.readyState >= 1) doSeek(); if (audio.readyState >= 1) doSeek();
else audio.addEventListener('loadedmetadata', doSeek, { once: true }); else audio.addEventListener('loadedmetadata', doSeek, { once: true });