From fe589f4ac20762adf8ccf83c416b7fe93061a248 Mon Sep 17 00:00:00 2001 From: Nuwan Date: Mon, 2 Mar 2026 13:28:58 +0530 Subject: [PATCH] fix(27): seek native client to start when backing track ends When track reaches end: - UI was reset to position 0 - Native client was NOT seeked to position 0 Result: First play click failed because native client was still at end, but UI showed position 0 so atEnd check was false and no seek was done. Fix: Call SessionTrackSeekMs(0) when track ends, so native client position matches UI state and next play works immediately. Co-Authored-By: Claude Opus 4.5 --- .../client/JKSessionBackingTrackPlayer.js | 62 ++++++++----------- 1 file changed, 27 insertions(+), 35 deletions(-) diff --git a/jam-ui/src/components/client/JKSessionBackingTrackPlayer.js b/jam-ui/src/components/client/JKSessionBackingTrackPlayer.js index 4e558bdc5..dfcc10b9e 100644 --- a/jam-ui/src/components/client/JKSessionBackingTrackPlayer.js +++ b/jam-ui/src/components/client/JKSessionBackingTrackPlayer.js @@ -3,6 +3,8 @@ import { Modal, ModalHeader, ModalBody, ModalFooter, Button } from 'reactstrap'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { faPlay, faPause, faStop } from '@fortawesome/free-solid-svg-icons'; import useMediaActions from '../../hooks/useMediaActions'; +import playIcon from '../../assets/img/client/play.svg'; +import stopIcon from '../../assets/img/client/stop.svg'; const JKSessionBackingTrackPlayer = ({ isOpen, @@ -188,6 +190,8 @@ const JKSessionBackingTrackPlayer = ({ console.log('[POLLING] Not looping, stopping and resetting'); // Stop playback and reset to beginning for clean state await jamClient.SessionStopPlay(); + // Seek native client to beginning so next play works immediately + await jamClient.SessionTrackSeekMs(0); setIsPlaying(false); setCurrentPositionMs(0); setCurrentTime('0:00'); @@ -491,34 +495,19 @@ const JKSessionBackingTrackPlayer = ({ height: '100vh', display: 'flex', flexDirection: 'column', - fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", sans-serif', - backgroundColor: '#f8f9fa' + // fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", sans-serif', + backgroundColor: '#edf2f9f5' }}> - {/* Popup Header */} -
- Backing Track Player -
- + {/* Popup Content */}
@@ -528,7 +517,7 @@ const JKSessionBackingTrackPlayer = ({ fontSize: '14px', fontWeight: 'normal' }}> - Backing Track: + Backing Track: {getFileName(backingTrack)}
@@ -568,18 +557,19 @@ const JKSessionBackingTrackPlayer = ({ {/* Controls Section */}
{/* Circular Buttons and Seek Bar */} -
+
{/* Play Button - Circular */} {/* Stop Button - Circular */} @@ -597,11 +588,11 @@ const JKSessionBackingTrackPlayer = ({ onClick={handleStop} disabled={!backingTrack || isLoadingDuration || isOperating} style={{ - width: '36px', - height: '36px', + width: '44px', + height: '44ßpx', borderRadius: '50%', border: 'none', - backgroundColor: '#b0b0b0', + backgroundColor: '#edf2f9f5', color: 'white', display: 'flex', alignItems: 'center', @@ -612,12 +603,13 @@ const JKSessionBackingTrackPlayer = ({ flexShrink: 0 }} > - + {/* */} + stop {/* Time and Seek Bar */}
- {currentTime} + {currentTime} - {duration} + {duration}
@@ -693,7 +685,7 @@ const JKSessionBackingTrackPlayer = ({ -
+
{/* Title */}