import { BlurView } from "expo-blur"; import React, { useEffect } from "react"; import { View } from "react-native"; import GoogleCast, { CastButton, useCastDevice, useDevices, useRemoteMediaClient, } from "react-native-google-cast"; type Props = { width?: number; height?: number; background?: "blur" | "transparent"; }; export const Chromecast: React.FC = ({ width = 48, height = 48, background = "transparent", }) => { const client = useRemoteMediaClient(); const castDevice = useCastDevice(); const devices = useDevices(); const sessionManager = GoogleCast.getSessionManager(); const discoveryManager = GoogleCast.getDiscoveryManager(); useEffect(() => { (async () => { if (!discoveryManager) { return; } await discoveryManager.startDiscovery(); })(); }, [client, devices, castDevice, sessionManager, discoveryManager]); if (background === "transparent") return ( ); return ( ); };