mirror of
https://github.com/streamyfin/streamyfin.git
synced 2026-03-20 16:26:24 +00:00
refactor: address GitHub Copilot review comments
- Remove unnecessary currentSegment from skipSegment dependency array - Remove redundant wrappedSeek wrapper (ref guard prevents issues) - Document 200ms setTimeout delay for seek operations - Improve code clarity and reduce unnecessary re-renders
This commit is contained in:
@@ -313,9 +313,12 @@ export const Controls: FC<Props> = ({
|
||||
const maxSeconds = maxMs ? msToSeconds(maxMs) : undefined;
|
||||
|
||||
// Wrapper to convert segment skip from seconds to milliseconds
|
||||
// Includes 200ms delay to allow seek operation to complete before resuming playback
|
||||
const seekMs = useCallback(
|
||||
(timeInSeconds: number) => {
|
||||
seek(timeInSeconds * 1000);
|
||||
// Brief delay ensures the seek operation completes before resuming playback
|
||||
// Without this, playback may resume from the old position
|
||||
setTimeout(() => {
|
||||
play();
|
||||
}, 200);
|
||||
|
||||
Reference in New Issue
Block a user