Optional
audioTrack: ILocalAudioTrack | IRemoteAudioTrackThe local or remote audio track. The local audio track can be created by calling useLocalMicrophoneTrack
. If undefined, the volume level is 0.
import { useVolumeLevel, useLocalMicrophoneTrack } from "agora-rtc-react";
function App() {
const audioTrack = useLocalMicrophoneTrack();
const volumeLevel = useVolumeLevel(audioTrack);
return <div>{volumeLevel}</div>;
}
Returns the volume level of an audio track at a frequency of once per second.