Whether it is ready to create the track. The default value is true
.
Configurations for initializing the microphone audio track. The default is { ANS: true, AEC: true }
. See MicrophoneAudioTrackInitConfig
for details.
Optional
client: IAgoraRTCClientCreated using the Web SDK's IAgoraRTC.createClient
method.
import { useLocalMicrophoneTrack } from "agora-rtc-react";
function App() {
const audioTrack = useLocalMicrophoneTrack(true, { ANS: true, AEC: true });
return <></>;
}
This hook lets you create a local microphone audio 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 audio track once before the component is destroyed. After the component is unmounted, the audio track created by this hook stops publishing.