This documentation is for reference only. We are no longer onboarding new customers to Programmable Video. Existing customers can continue to use the product until December 5, 2026.
We recommend migrating your application to the API provided by our preferred video partner, Zoom. We've prepared this migration guide to assist you in minimizing any service disruption.
This guide introduces the Dominant Speaker Detection API and provides guidance on how to use it effectively in your Twilio Video applications. The Dominant Speaker API is only available in Group Rooms.
In a multi-party video application, the dominant speaker is the Participant sharing the loudest audio track in the Room. The Dominant Speaker Detection API sends events to your application every time the dominant speaker changes. Developers can use those events to improve the end user's experience by bringing into focus the speakers published video tracks.
The Room.dominantSpeaker
property (Android, (iOS, JavaScript) represents the RemoteParticipant with the loudest RemoteAudioTrack. Whenever the Dominant Speaker changes, the Room emits a dominantSpeakerChanged
event.
Note: dominantSpeakerChanged
events are emitted in Group Rooms with 2 or more Participants.
The Dominant Speaker API is disabled by default, and is requested at connect time. The following table illustrates the currently supported platforms:
Twilio Video SDK | Dominant Speaker API support (Group Rooms) |
---|---|
Android | Yes (v4.3.0+) |
iOS | Yes (v2.8.0+) |
JavaScript | Yes (v1.14.0+) |
When building ConnectOptions
, set the property enableDominantSpeaker
to true
.
_10 ConnectOptions connectOptions =_10 new ConnectOptions.Builder(token)_10 .roomName(roomName)_10 .enableDominantSpeaker(true)_10 .build();_10Room room = Video.connect(context, connectOptions, roomListener);
Implement Room.Listener#onDominantSpeakerChanged(@NonNull Room room, @Nullable RemoteParticipant remoteParticipant) in order to respond to speaker events.
_10@Override_10void onDominantSpeakerChanged(_10 @NonNull Room room, @Nullable RemoteParticipant remoteParticipant) {_10 // Handle dominant speaker change_10 }
When building TVIConnectOptions
, set the property isDominantSpeakerEnabled
to true
.
_11let connectOptions = ConnectOptions(token: accessToken) { (builder) in_11 // Enable Dominant Speaker functionality_11 builder.isDominantSpeakerEnabled = true_11_11 if let localAudioTrack = self.localAudioTrack {_11 builder.audioTracks = [localAudioTrack]_11 }_11 builder.roomName = "my-conference-room"_11}_11_11room = TwilioVideoSDK.connect(options: connectOptions, delegate: self)
Implement -[TVIRoomDelegate room:dominantSpeakerDidChange:] in order to respond to speaker events.
_10// MARK: TVIRoomDelegate_10func dominantSpeakerDidChange(room: Room, participant: RemoteParticipant?) {_10 var identity = "N/A"_10_10 if let participant = participant {_10 identity = participant.identity_10 }_10_10 print("Dominant Speaker Changed: \(identity)")_10}
In the connect
method, set the property dominantSpeaker
to true
to enable the Dominant Speaker API and to start receiving dominantSpeakerChanged
events.
_14var Video = require('twilio-video');_14var token = getAccessToken();_14_14// Connect with custom names for LocalAudioTrack and LocalVideoTrack_14Video.connect(token, {_14 name: 'my-conference-room'_14 audio: { name: 'microphone' },_14 video: { name: 'camera' },_14 dominantSpeaker: true_14}).then(function(room) {_14 room.on('dominantSpeakerChanged', participant => {_14 console.log('The new dominant speaker in the Room is:', participant);_14 });_14});