fix(lastN): select screenshare endpoint always when auto pinning.

When trying to auto pin screenshare, always select the endpoint even though it happens to be the large video participant in redux. The auto pin screenshare logic kicks in after the track is added.  If the screenshare endpoint is not among the forwarded endpoints from the bridge, it needs to be selected again.
This commit is contained in:
Jaya Allamsetty 2020-11-19 16:42:49 -05:00 committed by Jaya Allamsetty
parent fc694641dc
commit d6ab0a72a1
1 changed files with 13 additions and 1 deletions

View File

@ -61,8 +61,20 @@ export function selectParticipantInLargeVideo(participant: ?string) {
const state = getState();
const participantId = participant ?? _electParticipantInLargeVideo(state);
const largeVideo = state['features/large-video'];
const screenShares = state['features/video-layout'].screenShares;
let latestScreenshareParticipantId;
if (participantId !== largeVideo.participantId) {
if (screenShares && screenShares.length) {
latestScreenshareParticipantId = screenShares[screenShares.length - 1];
}
// When trying to auto pin screenshare, always select the endpoint even though it happens to be
// the large video participant in redux (for the reasons listed above in the large video selection
// logic above). The auto pin screenshare logic kicks in after the track is added
// (which updates the large video participant and selects all endpoints because of the auto tile
// view mode). If the screenshare endpoint is not among the forwarded endpoints from the bridge,
// it needs to be selected again at this point.
if (participantId !== largeVideo.participantId || participantId === latestScreenshareParticipantId) {
dispatch({
type: SELECT_LARGE_VIDEO_PARTICIPANT,
participantId