onActiveSpeaker property

void Function(RtcConnection connection, int uid)? onActiveSpeaker
final

Callback when the most active remote speaker is detected.

After successfully calling enableAudioVolumeIndication, the SDK continuously monitors the remote user with the highest volume and counts how often the user is detected as having the highest volume. The remote user with the highest count during the current period is considered the most active speaker. When there are two or more users in the channel and a remote active speaker exists, the SDK triggers this callback and reports the uid of the most active remote speaker. If the most active speaker remains the same, the SDK does not trigger onActiveSpeaker again. If the most active speaker changes, the SDK triggers the callback again and reports the new uid.

  • connection Connection information. See RtcConnection.
  • uid ID of the most active remote speaker.

Implementation

final void Function(RtcConnection connection, int uid)? onActiveSpeaker;