import { forwardRef, useCallback, useContext, useEffect, useRef } from "react"; import { VideoPlayerContext, VideoPlayerContextProvider, VideoPlayerDispatchContext, } from "./VideoContext"; interface VideoPlayerProps { children?: React.ReactNode; } const VideoPlayerInternals = forwardRef((props, ref) => { const video = useContext(VideoPlayerContext); const dispatch = useContext(VideoPlayerDispatchContext); const onPlay = useCallback(() => { dispatch({ type: "CONTROL", do: "PLAY", soft: true, }); }, [dispatch]); const onPause = useCallback(() => { dispatch({ type: "CONTROL", do: "PAUSE", soft: true, }); }, [dispatch]); useEffect(() => {}, []); return ( ); }); export function VideoPlayer(props: VideoPlayerProps) { const playerRef = useRef(null); const playerWrapperRef = useRef(null); return (
{props.children}
); }