2023-01-23 23:01:08 +01:00
|
|
|
import { Icons } from "@/components/Icon";
|
2023-01-23 22:38:05 +01:00
|
|
|
import { VideoPlayerIconButton } from "../parts/VideoPlayerIconButton";
|
2023-01-08 21:18:45 +01:00
|
|
|
import { useVideoPlayerState } from "../VideoContext";
|
|
|
|
|
2023-01-09 21:51:24 +01:00
|
|
|
interface Props {
|
|
|
|
className?: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export function TimeControl(props: Props) {
|
2023-01-08 21:18:45 +01:00
|
|
|
const { videoState } = useVideoPlayerState();
|
2023-01-23 22:38:05 +01:00
|
|
|
|
|
|
|
const skipForward = () => {
|
|
|
|
videoState.setTime(videoState.time + 10);
|
|
|
|
};
|
|
|
|
|
|
|
|
const skipBackward = () => {
|
|
|
|
videoState.setTime(videoState.time - 10);
|
|
|
|
};
|
2023-01-08 21:18:45 +01:00
|
|
|
|
|
|
|
return (
|
2023-01-09 21:51:24 +01:00
|
|
|
<div className={props.className}>
|
2023-01-23 22:38:05 +01:00
|
|
|
<p className="flex select-none items-center text-white">
|
|
|
|
<VideoPlayerIconButton
|
|
|
|
icon={Icons.SKIP_BACKWARD}
|
|
|
|
onClick={skipBackward}
|
|
|
|
/>
|
|
|
|
<VideoPlayerIconButton
|
|
|
|
icon={Icons.SKIP_FORWARD}
|
|
|
|
onClick={skipForward}
|
|
|
|
/>
|
2023-01-09 21:51:24 +01:00
|
|
|
</p>
|
|
|
|
</div>
|
2023-01-08 21:18:45 +01:00
|
|
|
);
|
|
|
|
}
|