mirror of
https://github.com/movie-web/movie-web.git
synced 2024-12-25 19:01:52 +01:00
27 lines
626 B
TypeScript
27 lines
626 B
TypeScript
import { Icons } from "@/components/Icon";
|
|
import { useCallback } from "react";
|
|
import { VideoPlayerIconButton } from "../parts/VideoPlayerIconButton";
|
|
import { useVideoPlayerState } from "../VideoContext";
|
|
|
|
interface Props {
|
|
className?: string;
|
|
}
|
|
|
|
export function AirplayControl(props: Props) {
|
|
const { videoState } = useVideoPlayerState();
|
|
|
|
const handleClick = useCallback(() => {
|
|
videoState.startAirplay();
|
|
}, [videoState]);
|
|
|
|
if (!videoState.canAirplay) return null;
|
|
|
|
return (
|
|
<VideoPlayerIconButton
|
|
className={props.className}
|
|
onClick={handleClick}
|
|
icon={Icons.AIRPLAY}
|
|
/>
|
|
);
|
|
}
|