You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
992 B
42 lines
992 B
import { Icons } from "@/components/Icon"; |
|
import { VideoPlayerIconButton } from "../parts/VideoPlayerIconButton"; |
|
import { useVideoPlayerState } from "../VideoContext"; |
|
|
|
interface Props { |
|
className?: string; |
|
} |
|
|
|
export function SkipTimeBackward() { |
|
const { videoState } = useVideoPlayerState(); |
|
|
|
const skipBackward = () => { |
|
videoState.setTime(videoState.time - 10); |
|
}; |
|
|
|
return ( |
|
<VideoPlayerIconButton icon={Icons.SKIP_BACKWARD} onClick={skipBackward} /> |
|
); |
|
} |
|
|
|
export function SkipTimeForward() { |
|
const { videoState } = useVideoPlayerState(); |
|
|
|
const skipForward = () => { |
|
videoState.setTime(videoState.time + 10); |
|
}; |
|
|
|
return ( |
|
<VideoPlayerIconButton icon={Icons.SKIP_FORWARD} onClick={skipForward} /> |
|
); |
|
} |
|
|
|
export function TimeControl(props: Props) { |
|
return ( |
|
<div className={props.className}> |
|
<div className="flex select-none items-center text-white"> |
|
<SkipTimeBackward /> |
|
<SkipTimeForward /> |
|
</div> |
|
</div> |
|
); |
|
}
|
|
|