2016-10-05 14:36:59 +00:00
|
|
|
import { PARTICIPANT_ID_CHANGED } from '../base/participants';
|
|
|
|
import { ReducerRegistry } from '../base/redux';
|
|
|
|
|
2017-08-09 19:40:03 +00:00
|
|
|
import {
|
|
|
|
SELECT_LARGE_VIDEO_PARTICIPANT,
|
|
|
|
UPDATE_KNOWN_LARGE_VIDEO_RESOLUTION
|
|
|
|
} from './actionTypes';
|
2016-10-05 14:36:59 +00:00
|
|
|
|
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-10-05 14:36:59 +00:00
|
|
|
|
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) {
|
2016-10-05 14:36:59 +00:00
|
|
|
return {
|
|
|
|
...state,
|
2016-12-13 09:15:05 +00:00
|
|
|
participantId: action.newValue
|
2016-10-05 14:36:59 +00:00
|
|
|
};
|
|
|
|
}
|
2016-12-13 09:15:05 +00:00
|
|
|
break;
|
|
|
|
|
2017-01-11 18:14:00 +00:00
|
|
|
case SELECT_LARGE_VIDEO_PARTICIPANT:
|
2016-12-13 09:15:05 +00:00
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
participantId: action.participantId
|
|
|
|
};
|
2017-08-09 19:40:03 +00:00
|
|
|
|
|
|
|
case UPDATE_KNOWN_LARGE_VIDEO_RESOLUTION:
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
resolution: action.resolution
|
|
|
|
};
|
2016-12-13 09:15:05 +00:00
|
|
|
}
|
2016-11-04 18:28:47 +00:00
|
|
|
|
2016-12-13 09:15:05 +00:00
|
|
|
return state;
|
|
|
|
});
|