A small web app for watching movies and shows easily
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.
 
 
 
 
 

24 lines
592 B

import { useCallback } from "react";
import { useVideoPlayerState } from "../VideoContext";
export function PauseControl() {
const { videoState } = useVideoPlayerState();
const handleClick = useCallback(() => {
if (videoState?.isPlaying) videoState.pause();
else videoState.play();
}, [videoState]);
const text =
videoState.isPlaying || videoState.isSeeking ? "playing" : "paused";
return (
<button
className="m-1 rounded bg-denim-100 p-1 text-white hover:opacity-75"
type="button"
onClick={handleClick}
>
{text}
</button>
);
}