Dominant speaker just working with 3 or more participants

I added a listener in conference to monitor who is the dominant speaker.
With 3 users, everything works fine.
With 2 users DOMINANT_SPEAKER_CHANGE is fired only when participant join on conference.

Does anyone has any idea about what’s happening?

My test code is very simple:

room.on(
        DOMINANT_SPEAKER_CHANGED,
        (id) => console.warn(id));

Thanks.

It can be applied for 2 or more participants.
The variable you have to watch; conference.dominantSpeaker

<script>
    function connectRoom() {
        try {
            var room = APP.conference._room;
            room.on("conference.dominantSpeaker", changedActiveSpeaker);

        } catch(e) {
            setTimeout(function(){connectRoom()}, 3000);
        }
    };
    function changedActiveSpeaker() {
        var container = $('#filmstripRemoteVideosContainer');
        container.find('.videocontainer').sort(function(a, b) {
           return $(a).hasClass('active-speaker') && !$(b).hasClass('active-speaker') ? 1: -1;
        }).appendTo(container)
    }

connectRoom();
</script>

wrote for filmStrip.

We have a development about this, you can examine it.

bayraktarulku, I’m watching “conference.dominantSpeaker”.

I’ll study your code to find what i’m doing wrong.

thanks for your answer.