fix(video-layout):Screenshares not updated on time
This commit is contained in:
parent
d718d9d8fb
commit
74384bfa66
|
@ -1021,7 +1021,7 @@ function _mapStateToProps(state, ownProps): Object {
|
||||||
_localFlipX: Boolean(localFlipX),
|
_localFlipX: Boolean(localFlipX),
|
||||||
_participant: participant,
|
_participant: participant,
|
||||||
_raisedHand: hasRaisedHand(participant),
|
_raisedHand: hasRaisedHand(participant),
|
||||||
_videoObjectPosition: getVideoObjectPosition(state, participant.id),
|
_videoObjectPosition: getVideoObjectPosition(state, participant?.id),
|
||||||
_videoTrack,
|
_videoTrack,
|
||||||
...size
|
...size
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
import { getCurrentConference } from '../base/conference';
|
import { getCurrentConference } from '../base/conference';
|
||||||
|
import { VIDEO_TYPE } from '../base/media';
|
||||||
import {
|
import {
|
||||||
PARTICIPANT_LEFT,
|
PARTICIPANT_LEFT,
|
||||||
PIN_PARTICIPANT,
|
PIN_PARTICIPANT,
|
||||||
|
@ -9,11 +10,12 @@ import {
|
||||||
getPinnedParticipant
|
getPinnedParticipant
|
||||||
} from '../base/participants';
|
} from '../base/participants';
|
||||||
import { MiddlewareRegistry, StateListenerRegistry } from '../base/redux';
|
import { MiddlewareRegistry, StateListenerRegistry } from '../base/redux';
|
||||||
|
import { TRACK_REMOVED } from '../base/tracks';
|
||||||
import { SET_DOCUMENT_EDITING_STATUS } from '../etherpad';
|
import { SET_DOCUMENT_EDITING_STATUS } from '../etherpad';
|
||||||
import { isFollowMeActive } from '../follow-me';
|
import { isFollowMeActive } from '../follow-me';
|
||||||
|
|
||||||
import { SET_TILE_VIEW } from './actionTypes';
|
import { SET_TILE_VIEW } from './actionTypes';
|
||||||
import { setTileView } from './actions';
|
import { setRemoteParticipantsWithScreenShare, setTileView } from './actions';
|
||||||
import { getAutoPinSetting, updateAutoPinnedParticipant } from './functions';
|
import { getAutoPinSetting, updateAutoPinnedParticipant } from './functions';
|
||||||
|
|
||||||
import './subscriber';
|
import './subscriber';
|
||||||
|
@ -70,6 +72,32 @@ MiddlewareRegistry.register(store => next => action => {
|
||||||
if (action.enabled && getPinnedParticipant(store)) {
|
if (action.enabled && getPinnedParticipant(store)) {
|
||||||
store.dispatch(pinParticipant(null));
|
store.dispatch(pinParticipant(null));
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
// Update the remoteScreenShares.
|
||||||
|
// Because of the debounce in the subscriber which updates the remoteScreenShares we need to handle
|
||||||
|
// removal of screen shares separatelly here. Otherwise it is possible to have screen sharing
|
||||||
|
// participant that has already left in the remoteScreenShares array. This can lead to rendering
|
||||||
|
// a thumbnails for already left participants since the remoteScreenShares array is used for
|
||||||
|
// building the ordered list of remote participants.
|
||||||
|
case TRACK_REMOVED: {
|
||||||
|
const { jitsiTrack } = action.track;
|
||||||
|
|
||||||
|
if (jitsiTrack && jitsiTrack.isVideoTrack() && jitsiTrack.getVideoType() === VIDEO_TYPE.DESKTOP) {
|
||||||
|
const participantId = jitsiTrack.getParticipantId();
|
||||||
|
const oldScreenShares = store.getState()['features/video-layout'].remoteScreenShares || [];
|
||||||
|
const newScreenShares = oldScreenShares.filter(id => id !== participantId);
|
||||||
|
|
||||||
|
if (oldScreenShares.length !== newScreenShares.length) { // the participant was removed
|
||||||
|
store.dispatch(setRemoteParticipantsWithScreenShare(newScreenShares));
|
||||||
|
|
||||||
|
updateAutoPinnedParticipant(oldScreenShares, store);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (shouldUpdateAutoPin) {
|
if (shouldUpdateAutoPin) {
|
||||||
|
|
|
@ -16,6 +16,10 @@ import { getAutoPinSetting, updateAutoPinnedParticipant } from './functions';
|
||||||
StateListenerRegistry.register(
|
StateListenerRegistry.register(
|
||||||
/* selector */ state => state['features/base/tracks'],
|
/* selector */ state => state['features/base/tracks'],
|
||||||
/* listener */ debounce((tracks, store) => {
|
/* listener */ debounce((tracks, store) => {
|
||||||
|
// Because of the debounce we need to handle removal of screen shares in the middleware. Otherwise it is
|
||||||
|
// possible to have screen sharing participant that has already left in the remoteScreenShares array.
|
||||||
|
// This can lead to rendering a thumbnails for already left participants since the remoteScreenShares
|
||||||
|
// array is used for building the ordered list of remote participants.
|
||||||
if (!getAutoPinSetting() || isFollowMeActive(store)) {
|
if (!getAutoPinSetting() || isFollowMeActive(store)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue