|
|
|
@ -110,33 +110,35 @@ function _electLastVisibleRemoteVideo(tracks) { |
|
|
|
|
* @returns {(string|undefined)} |
|
|
|
|
*/ |
|
|
|
|
function _electParticipantInLargeVideo(state) { |
|
|
|
|
// First get the pinned participant. If a participant is pinned, they will
|
|
|
|
|
// be shown in the LargeVideo.
|
|
|
|
|
// 1. If a participant is pinned, they will be shown in the LargeVideo (
|
|
|
|
|
// regardless of whether they are local or remote).
|
|
|
|
|
const participants = state['features/base/participants']; |
|
|
|
|
let participant = participants.find(p => p.pinned); |
|
|
|
|
let id = participant && participant.id; |
|
|
|
|
|
|
|
|
|
if (!id) { |
|
|
|
|
// No participant is pinned so get the dominant speaker. But the local
|
|
|
|
|
// participant won't be displayed in LargeVideo even if he/she is the
|
|
|
|
|
// dominant speaker.
|
|
|
|
|
// 2. No participant is pinned so get the dominant speaker. But the
|
|
|
|
|
// local participant won't be displayed in LargeVideo even if she is
|
|
|
|
|
// the dominant speaker.
|
|
|
|
|
participant = participants.find(p => p.dominantSpeaker && !p.local); |
|
|
|
|
id = participant && participant.id; |
|
|
|
|
|
|
|
|
|
if (!id) { |
|
|
|
|
// There is no dominant speaker so select the participant which last
|
|
|
|
|
// had visible video (excluding ourselves).
|
|
|
|
|
// 3. There is no dominant speaker so select the remote participant
|
|
|
|
|
// who last had visible video.
|
|
|
|
|
const tracks = state['features/base/tracks']; |
|
|
|
|
const videoTrack = _electLastVisibleRemoteVideo(tracks); |
|
|
|
|
|
|
|
|
|
id = videoTrack && videoTrack.participantId; |
|
|
|
|
|
|
|
|
|
if (!id) { |
|
|
|
|
// It's possible there is no participant with visible video,
|
|
|
|
|
// this can happen for a number or reasons:
|
|
|
|
|
// - there is only one participant (the local user)
|
|
|
|
|
// - other participants joined with video muted
|
|
|
|
|
// As a last resort, pick the last participant.
|
|
|
|
|
// 4. It's possible there is no participant with visible video.
|
|
|
|
|
// This can happen for a number of reasons:
|
|
|
|
|
// - there is only one participant (i.e. the local user),
|
|
|
|
|
// - other participants joined with video muted.
|
|
|
|
|
// As a last resort, pick the last participant who joined the
|
|
|
|
|
// conference (regardless of whether they are local or
|
|
|
|
|
// remote).
|
|
|
|
|
participant = participants[participants.length - 1]; |
|
|
|
|
id = participant && participant.id; |
|
|
|
|
} |
|
|
|
|