Function useLocalCameraTrack

  • This hook lets you create a local camera video track. You can call this method multiple times in different components to create multiple tracks. To access the same track in multiple components, pass the same track object to those components. This hook can only create the video track once before the component is destroyed. After the component is unmounted, the video track created by this hook stops publishing.

    Parameters

    Returns {
        error: AgoraRTCReactError | null;
        isLoading: boolean;
        localCameraTrack: ICameraVideoTrack | null;
    }

    Example

    import { useLocalCameraTrack } from "agora-rtc-react";

    function App() {
    const videoTrack = useLocalCameraTrack();

    return <></>;
    }