import { Transition } from "@/components/Transition"; import { useIsMobile } from "@/hooks/useIsMobile"; import { AirplayAction } from "@/video/components/actions/AirplayAction"; import { BackdropAction } from "@/video/components/actions/BackdropAction"; import { FullscreenAction } from "@/video/components/actions/FullscreenAction"; import { HeaderAction } from "@/video/components/actions/HeaderAction"; import { LoadingAction } from "@/video/components/actions/LoadingAction"; import { MiddlePauseAction } from "@/video/components/actions/MiddlePauseAction"; import { MobileCenterAction } from "@/video/components/actions/MobileCenterAction"; import { PageTitleAction } from "@/video/components/actions/PageTitleAction"; import { PauseAction } from "@/video/components/actions/PauseAction"; import { ProgressAction } from "@/video/components/actions/ProgressAction"; import { QualityDisplayAction } from "@/video/components/actions/QualityDisplayAction"; import { SeriesSelectionAction } from "@/video/components/actions/SeriesSelectionAction"; import { SourceSelectionAction } from "@/video/components/actions/SourceSelectionAction"; import { CaptionsSelectionAction } from "@/video/components/actions/CaptionsSelectionAction"; import { ShowTitleAction } from "@/video/components/actions/ShowTitleAction"; import { KeyboardShortcutsAction } from "@/video/components/actions/KeyboardShortcutsAction"; import { SkipTimeAction } from "@/video/components/actions/SkipTimeAction"; import { TimeAction } from "@/video/components/actions/TimeAction"; import { VolumeAction } from "@/video/components/actions/VolumeAction"; import { VideoPlayerError } from "@/video/components/parts/VideoPlayerError"; import { VideoPlayerBase, VideoPlayerBaseProps, } from "@/video/components/VideoPlayerBase"; import { useVideoPlayerDescriptor } from "@/video/state/hooks"; import { useControls } from "@/video/state/logic/controls"; import { ReactNode, useCallback, useState } from "react"; import { PopoutProviderAction } from "@/video/components/popouts/PopoutProviderAction"; import { ChromecastAction } from "@/video/components/actions/ChromecastAction"; import { CastingTextAction } from "@/video/components/actions/CastingTextAction"; import { DownloadAction } from "@/video/components/actions/DownloadAction"; import { PictureInPictureAction } from "@/video/components/actions/PictureInPictureAction"; import { CaptionRenderer } from "./CaptionRenderer"; type Props = VideoPlayerBaseProps; function CenterPosition(props: { children: ReactNode }) { return (
{props.children}
); } function LeftSideControls() { const descriptor = useVideoPlayerDescriptor(); const controls = useControls(descriptor); const handleMouseEnter = useCallback(() => { controls.setLeftControlsHover(true); }, [controls]); const handleMouseLeave = useCallback(() => { controls.setLeftControlsHover(false); }, [controls]); return ( <>
); } export function VideoPlayer(props: Props) { const [show, setShow] = useState(false); const { isMobile } = useIsMobile(); const onBackdropChange = useCallback( (showing: boolean) => { setShow(showing); }, [setShow] ); return ( {({ isFullscreen }) => ( <> {isMobile ? ( ) : ( "" )}
{isMobile && }
{isMobile ? (
) : ( <>
)}
{show ? : null} {props.children} )} ); }