onAudioVolumeIndication property

void Function(RtcConnection connection, List<AudioVolumeInfo> speakers, int speakerNumber, int totalVolume)? onAudioVolumeIndication
final

Reports the volume information of users.

By default, this callback is disabled. You can enable it by calling enableAudioVolumeIndication. Once this callback is enabled and users send streams in the channel, the SDK triggers the onAudioVolumeIndication callback according to the time interval set in enableAudioVolumeIndication. The SDK triggers two independent onAudioVolumeIndication callbacks simultaneously, which separately report the volume information of the local user who sends a stream and the remote users (up to three) whose instantaneous volume is the highest. Once this callback is enabled, if the local user calls the muteLocalAudioStream method to mute, the SDK continues to report the volume indication of the local user. If a remote user whose volume is one of the three highest in the channel stops publishing the audio stream for 20 seconds, the callback excludes this user's information; if all remote users stop publishing audio streams for 20 seconds, the SDK stops triggering the callback for remote users.

  • connection The connection information. See RtcConnection.
  • speakers The volume information of the users. See AudioVolumeInfo. An empty speakers array in the callback indicates that no remote user is in the channel or is sending a stream.
  • speakerNumber The total number of users. In the callback for the local user, if the local user is sending streams, the value of speakerNumber is 1. In the callback for remote users, the value range of speakerNumber is 0,3. If the number of remote users who send streams is greater than or equal to three, the value of speakerNumber is 3.
  • totalVolume The volume of the speaker. The value range is 0,255. In the callback for the local user, totalVolume is the volume of the local user who sends a stream. In the callback for remote users, totalVolume is the sum of the volume of all remote users (up to three) whose instantaneous volume is the highest.

Implementation

final void Function(RtcConnection connection, List<AudioVolumeInfo> speakers,
    int speakerNumber, int totalVolume)? onAudioVolumeIndication;