Function useRemoteAudioTracks

  • This hook lets you automatically subscribe to and retrieve remote users' audio tracks. When the component is unmounted, this hook stops subscribing to the audio tracks of the specified users. This hook updates the subscribed audio tracks when the users parameter changes.

    Parameters

    Returns {
        audioTracks: IRemoteAudioTrack[];
        error: AgoraRTCReactError | null;
        isLoading: boolean;
    }

    Example

    import { useRemoteUsers, useRemoteVideoTracks } from "agora-rtc-react";

    function App() {
    //get remote user list
    const remoteUsers = useRemoteUsers();
    const videoTracks = useRemoteVideoTracks(remoteUsers);

    return <></>;
    }