diff --git a/README.md b/README.md index 7e2538f..9a4e02e 100644 --- a/README.md +++ b/README.md @@ -80,6 +80,7 @@ export default function App() { | `height` | `string \| number` | `"auto"` | Height of player | | `className` | `string` | `""` | Custom CSS class | | `color` | `string` | `"#ff0000"` | Primary color (progress, volume, etc.) | +| `skipSeconds` | `number` | `10` | Custom forward and backward skip value (in seconds) --- diff --git a/src/ReactNextPlayer.tsx b/src/ReactNextPlayer.tsx index f4b9836..551c327 100644 --- a/src/ReactNextPlayer.tsx +++ b/src/ReactNextPlayer.tsx @@ -13,6 +13,7 @@ export interface ReactNextPlayerProps { height?: string | number; className?: string; color?: string; + skipSeconds?: number; onPlay?: () => void; onPause?: () => void; onTimeUpdate?: (currentTime: number) => void; @@ -31,6 +32,7 @@ const ReactNextPlayer: React.FC = ({ height = "auto", className = "", color = "#ff0000", + skipSeconds = 10, onPlay, onPause, onTimeUpdate, @@ -115,19 +117,19 @@ const ReactNextPlayer: React.FC = ({ if (videoRef.current) { videoRef.current.currentTime = Math.max( 0, - videoRef.current.currentTime - 10 + videoRef.current.currentTime - skipSeconds ); } - }, []); + }, [skipSeconds]); const handleSkipForward = useCallback(() => { if (videoRef.current) { videoRef.current.currentTime = Math.min( duration, - videoRef.current.currentTime + 10 + videoRef.current.currentTime + skipSeconds ); } - }, [duration]); + }, [duration, skipSeconds]); const handleTimeUpdate = useCallback(() => { if (videoRef.current) { @@ -730,9 +732,8 @@ const ReactNextPlayer: React.FC = ({
= ({ {/* Center play/pause overlay - only show when paused or on hover */}
{isPlaying ? ( @@ -798,9 +798,8 @@ const ReactNextPlayer: React.FC = ({ {controls && (