diff --git a/jam-ui/src/components/client/JKSessionBackingTrackPlayer.js b/jam-ui/src/components/client/JKSessionBackingTrackPlayer.js index dfcc10b9e..02f11c994 100644 --- a/jam-ui/src/components/client/JKSessionBackingTrackPlayer.js +++ b/jam-ui/src/components/client/JKSessionBackingTrackPlayer.js @@ -299,15 +299,16 @@ const JKSessionBackingTrackPlayer = ({ // Check if we're at the very end (within 50ms to avoid false positives from slider dragging) const atEnd = currentPositionMs >= durationMs - 50 && durationMs > 0; - console.log('[PLAY] At end check:', { currentPositionMs, durationMs, atEnd, threshold: durationMs - 50 }); + // Check if we're at the beginning (position 0 or very close) + const atBeginning = currentPositionMs < 100; + console.log('[PLAY] Position check:', { currentPositionMs, durationMs, atEnd, atBeginning }); - if (atEnd) { - console.log('[PLAY] At end, resetting to start'); - // Stop first to reset state + if (atEnd || atBeginning) { + // Native client needs Stop -> Seek -> Play sequence to reliably start + // This handles both "at end" and "at beginning after track finished" cases + console.log('[PLAY] At end or beginning, doing full reset sequence'); await jamClient.SessionStopPlay(); - // Seek to start await jamClient.SessionTrackSeekMs(0); - // Update UI state setCurrentPositionMs(0); setCurrentTime('0:00'); }