Improve seekTo UI responsiveness by updating elapsed time immediately
Enhancement Request
Currently, the seekTo function in src/index.ts performs the seek operation on the provider controller but does not update the store's time.elapsed value immediately. This causes a delay in UI updates until the watchdog catches up.
Proposed Solution
Update time.elapsed immediately after computing and clamping the seek position to provide instant UI feedback:
const seekTo = (seconds: number) => {
const { time, status } = store.getState();
if (status === 'stopped') return;
const controller = providerController();
if (\!controller) return;
seconds += time.start;
if (seconds < time.start) seconds = time.start;
if (seconds > time.end) seconds = time.end;
controller.seekTo(seconds);
const { setTime } = store.getState();
setTime({ ...time, elapsed: seconds - time.start });
};
Benefits
- Improved user experience with immediate UI updates
- Maintains existing watchdog fallback for consistency
- No breaking changes to the API
References
- Original suggestion: !1 (comment 1421)
- File:
src/index.tslines 105-117
Requested by: @kenzenfuyuba