movie-web/src/components/video/controls/TimeControl.tsx

35 lines
835 B
TypeScript
Raw Normal View History

2023-01-23 23:01:08 +01:00
import { Icons } from "@/components/Icon";
import { VideoPlayerIconButton } from "../parts/VideoPlayerIconButton";
import { useVideoPlayerState } from "../VideoContext";
2023-01-09 21:51:24 +01:00
interface Props {
className?: string;
}
export function TimeControl(props: Props) {
const { videoState } = useVideoPlayerState();
const skipForward = () => {
videoState.setTime(videoState.time + 10);
};
const skipBackward = () => {
videoState.setTime(videoState.time - 10);
};
return (
2023-01-09 21:51:24 +01:00
<div className={props.className}>
<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>
);
}