1

How to display the dominant speaker in the primary view in the quickstart application of Android .

https://github.com/twilio/video-quickstart-android/tree/master/quickstart

Thanks & Regards Sylendra

Edit

Added code:

public void OnDominantSpeakerChanged(Room room, RemoteParticipant remoteParticipant) {
  if (remoteParticipant!=null) {
    if (remoteParticipant.RemoteVideoTracks.Count > 0) {
      RemoteVideoTrackPublication remoteVideoTrackPublication = remoteParticipant.RemoteVideoTracks[0];
      remoteParticipantIdentity = remoteParticipant.Identity;
      AddRemoteParticipantVideo(remoteVideoTrackPublication.RemoteVideoTrack); 
    }
  }
}
philnash
  • 70,667
  • 10
  • 60
  • 88

1 Answers1

0

Twilio developer evangelist here.

You can detect the dominant speaker by listening for dominantSpeakerChanged events from the Room object in Group rooms. For Android, you need to be using version 4.3.0 or higher to enable support.

Check out the documentation on detecting dominant speaker in Twilio Video here.

philnash
  • 70,667
  • 10
  • 60
  • 88
  • Hi Philnash , thank you for your reply . I used the below code for the quickstart application of the android which was downloaded from the GitHub provided by the Twilio . But the all the participants videos are blinking in the primaryvideoview – SYLENDRA BABU J R Oct 08 '19 at 04:12
  • Can you edit your question with the code you are using to detect the dominant speaker? – philnash Oct 08 '19 at 04:13
  • public void OnDominantSpeakerChanged(Room room, RemoteParticipant remoteParticipant) { if (remoteParticipant!=null) { if (remoteParticipant.RemoteVideoTracks.Count > 0) { RemoteVideoTrackPublication remoteVideoTrackPublication = remoteParticipant.RemoteVideoTracks[0]; remoteParticipantIdentity = remoteParticipant.Identity;AddRemoteParticipantVideo(remoteVideoTrackPublication.RemoteVideoTrack); } } } – SYLENDRA BABU J R Oct 08 '19 at 04:14
  • Did you make sure to add `.enableDominantSpeaker(true)` to your connect options? Also, the method you need to override is `onDominantSpeakerChanged` with a lowercase `o` at the start. – philnash Oct 08 '19 at 04:28
  • I already added .enableDominantSpeaker(true) and the below is the code but still it is not working as expected Override public void onDominantSpeakerChanged(NonNull Room room, Nullable RemoteParticipant remoteParticipant) { if (remoteParticipant!=null){ RemoteVideoTrackPublication remoteVideoTrackPublication = remoteParticipant.getRemoteVideoTracks().get(0); addRemoteParticipantVideo(remoteVideoTrackPublication.getRemoteVideoTrack()); } } – SYLENDRA BABU J R Oct 08 '19 at 04:36
  • When you say it is not working as expected, what is it doing? Please descrbie the issue in detail. – philnash Oct 08 '19 at 05:27
  • Hi Philnash , I already mentioned in the first comment that "all the participants videos are blinking in the primaryvideoview" , I want to display the dominant speaker video in the primary View , but it is not happening here instead all the participants videos are blinking . – SYLENDRA BABU J R Oct 08 '19 at 06:31
  • Ok, how many participants are you testing with? Are you finding that this is happening because the `onDominantSpeakerChanged` method is being called over and over or do you think it's something to do with the way you are adding the dominant speaker's video to the primaryvideoview? Is it possible that you are seeing this because you are testing with multiple devices in the same room and they are registering the same noise, so thrashing the dominant speaker event? – philnash Oct 08 '19 at 06:33
  • I'm testing with 3 users in the room . Let me test it in the different locations ... – SYLENDRA BABU J R Oct 08 '19 at 07:11
  • Hi I tested in different locations , but still there is blinking issue , Can't able to see the dominant speaker video clearly . – SYLENDRA BABU J R Oct 08 '19 at 07:25
  • Can you test just showing the identity of the dominant speaker? Rather than changing the video. Just to see if it’s something to do with the event firing or rendering the video. (Sorry I don’t have an answer for this, I’m not an Android dev, just trying to guide you in the right direction.) – philnash Oct 08 '19 at 07:29
  • Philnash you can see the activity code which I'm using from the below link https://drive.google.com/file/d/1cx05JL0XhAMAGr_DSIsW7t4Eus-XsiyE/view?usp=sharing – SYLENDRA BABU J R Oct 08 '19 at 07:31
  • Showing me the code isn’t going to help, I’m not an Android dev. Have you tried changing from moving videos to just showing the currently dominant identity? – philnash Oct 08 '19 at 07:33