onAudioVolumeIndication property
Callback for user audio volume indication.
This callback is disabled by default. You can enable it using enableAudioVolumeIndication. Once enabled, as long as there are users publishing streams in the channel, the SDK triggers the onAudioVolumeIndication callback at the interval set in enableAudioVolumeIndication after joining the channel. Each time, two onAudioVolumeIndication callbacks are triggered: one reports the local user's volume information, and the other reports the volume information of the remote users (up to 3) with the highest instantaneous volume. After enabling this feature, if a user mutes themselves (by calling muteLocalAudioStream), the SDK continues to report the local user's volume indication callback. If the remote user with the highest instantaneous volume mutes themselves for 20 seconds, they will no longer be included in the remote volume indication callback. If all remote users mute themselves, the SDK stops reporting remote volume indication callbacks after 20 seconds.
connectionConnection information. See RtcConnection.speakersUser volume information. See the AudioVolumeInfo array. If speakers is empty, it means no remote users are publishing streams or there are no remote users.speakerNumberNumber of users. In the local user's callback, as long as the local user is publishing, speakerNumber is always 1. In the remote users' callback, speakerNumber ranges from0,3. If there are more than 3 remote users publishing, speakerNumber is 3.totalVolumeTotal mixed volume, range0,255. In the local user's callback, totalVolume is the local user's volume. In the remote users' callback, totalVolume is the total mixed volume of the top 3 remote users with the highest instantaneous volume.
Implementation
final void Function(RtcConnection connection, List<AudioVolumeInfo> speakers,
int speakerNumber, int totalVolume)? onAudioVolumeIndication;