2022-08-10 09:56:24 +00:00
|
|
|
import { PARTICIPANT_ID_CHANGED } from '../base/participants/actionTypes';
|
|
|
|
import ReducerRegistry from '../base/redux/ReducerRegistry';
|
2016-10-05 14:36:59 +00:00
|
|
|
|
2017-08-09 19:40:03 +00:00
|
|
|
import {
|
|
|
|
SELECT_LARGE_VIDEO_PARTICIPANT,
|
2022-08-05 09:11:09 +00:00
|
|
|
UPDATE_KNOWN_LARGE_VIDEO_RESOLUTION,
|
|
|
|
UPDATE_LAST_LARGE_VIDEO_MEDIA_EVENT,
|
|
|
|
SET_SEE_WHAT_IS_BEING_SHARED
|
2017-08-09 19:40:03 +00:00
|
|
|
} from './actionTypes';
|
2016-10-05 14:36:59 +00:00
|
|
|
|
2022-08-10 09:56:24 +00:00
|
|
|
export interface ILargeVideoState {
|
|
|
|
lastMediaEvent?: string;
|
|
|
|
participantId?: string;
|
|
|
|
resolution?: number;
|
|
|
|
seeWhatIsBeingShared?: boolean;
|
|
|
|
}
|
|
|
|
|
|
|
|
ReducerRegistry.register('features/large-video', (state: ILargeVideoState = {}, 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
|
|
|
|
};
|
2020-12-08 14:01:16 +00:00
|
|
|
|
|
|
|
case UPDATE_LAST_LARGE_VIDEO_MEDIA_EVENT:
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
lastMediaEvent: action.name
|
|
|
|
};
|
|
|
|
|
2022-08-05 09:11:09 +00:00
|
|
|
case SET_SEE_WHAT_IS_BEING_SHARED:
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
seeWhatIsBeingShared: action.seeWhatIsBeingShared
|
|
|
|
};
|
|
|
|
|
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;
|
|
|
|
});
|