cuddly-lizard-69432
03/27/2025, 6:02 PMtall-airline-16756
03/27/2025, 6:02 PMtall-airline-16756
03/27/2025, 6:03 PMgetVolume()
method, which gets the volume on the participant's microphone track. You can specify the source (Microphone or ScreenShareAudio), with Microphone being the default.
◦ In Unity SDK: Use the GetVolume()
method, which returns a float value representing the volume.
Unfortunately, the sources do not provide specific information about getting the volume for LocalParticipant.
Sources: RemoteParticipant | LiveKit JS Client SDK - v2.8.1 | Class RemoteParticipant | LiveKit Unity SDK | Core API primitives | LiveKit Docscuddly-lizard-69432
03/27/2025, 6:06 PMtall-airline-16756
03/27/2025, 6:06 PMgetVolume
and useTrackVolume
in LiveKit:
• Implementation Type:
◦ getVolume
is a method available on RemoteAudioTrack
and RemoteParticipant
classes.
◦ useTrackVolume
is a React hook specifically for React Native applications.
• Usage Context:
◦ getVolume
is used in a more traditional imperative programming approach.
◦ useTrackVolume
follows React's hooks pattern for functional components.
• Return Behavior:
◦ Both return a number between 0-1 representing volume.
◦ getVolume
on RemoteParticipant
can return undefined
in some cases.
◦ useTrackVolume
always returns a number.
• Parameters:
◦ getVolume
on RemoteParticipant
accepts an optional source parameter (Microphone or ScreenShareAudio).
◦ useTrackVolume
accepts an optional trackOrTrackReference
parameter. Sources: RemoteAudioTrack | LiveKit JS Client SDK - v2.8.1 | RemoteParticipant | LiveKit JS Client SDK - v2.8.1 | useTrackVolume | LiveKit React Native Client SDK - v2.6.0