movie-web/__old/controls/TimeControl.tsx

43 lines
992 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 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 (
2023-01-09 21:51:24 +01:00
<div className={props.className}>
<div className="flex select-none items-center text-white">
<SkipTimeBackward />
<SkipTimeForward />
</div>
2023-01-09 21:51:24 +01:00
</div>
);
}