メニュー

Rate this page:

Thanks for rating this page!

We are always striving to improve our documentation quality, and your feedback is valuable to us. How could this documentation serve you better?

Detecting the Dominant Speaker

This guide introduces the Dominant Speaker Detection API and provides guidance on how to use it effectively in your Twilio Video applications. Dominant Speaker Detection API is available only 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 dominant speakers published video tracks.

APIの使用方法

The Room dominantSpeaker property represents the RemoteParticipant with the loudest RemoteAudioTrack. Whenever the Dominant Speaker changes, the Room emits a dominantSpeakerChanged event.

Note: dominantSpeakerChanged events are emitted in rooms with 3+ participants.

Enabling Dominant Speaker Detection

In the connect method, set the property dominantSpeaker to true to enable the Dominant Speaker API and to start receiving dominantSpeakerChanged events.

var Video = require('twilio-video');
var token = getAccessToken();

// Connect with custom names for LocalAudioTrack and LocalVideoTrack
Video.connect(token, {
  name: 'my-cool-room'
  audio: { name: 'microphone' },
  video: { name: 'camera' },
  dominantSpeaker: true
}).then(function(room) {
  room.localParticipants.trackPublications.forEach(function(publication) {
    console.log('The LocalTrack "' + publication.trackName + '" was successfully published');
  });
});
Rate this page:

ヘルプが必要ですか?

We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd browsing the Twilio tag on Stack Overflow.