jiti-meet/react/features/large-video/reducer.js

32 lines
1.0 KiB
JavaScript
Raw Normal View History

import { PARTICIPANT_ID_CHANGED } from '../base/participants';
import { ReducerRegistry } from '../base/redux';
import { SELECT_LARGE_VIDEO_PARTICIPANT } from './actionTypes';
2017-01-17 14:44:50 +00:00
ReducerRegistry.register('features/large-video', (state = {}, action) => {
2016-12-13 09:15:05 +00:00
switch (action.type) {
2016-12-13 09:15:05 +00:00
// When conference is joined, we update ID of local participant from default
// 'local' to real ID. However, in large video we might have already
// selected 'local' as participant on stage. So in this case we must update
// ID of participant on stage to match ID in 'participants' state to avoid
// additional changes in state and (re)renders.
case PARTICIPANT_ID_CHANGED:
if (state.participantId === action.oldValue) {
return {
...state,
2016-12-13 09:15:05 +00:00
participantId: action.newValue
};
}
2016-12-13 09:15:05 +00:00
break;
case SELECT_LARGE_VIDEO_PARTICIPANT:
2016-12-13 09:15:05 +00:00
return {
...state,
participantId: action.participantId
};
}
2016-12-13 09:15:05 +00:00
return state;
});