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-16 11:56:47 +00:00
|
|
|
SET_LARGE_VIDEO_DIMENSIONS,
|
2022-09-27 07:10:28 +00:00
|
|
|
SET_SEE_WHAT_IS_BEING_SHARED,
|
2022-08-05 09:11:09 +00:00
|
|
|
UPDATE_KNOWN_LARGE_VIDEO_RESOLUTION,
|
2022-09-27 07:10:28 +00:00
|
|
|
UPDATE_LAST_LARGE_VIDEO_MEDIA_EVENT
|
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 {
|
2022-09-05 09:05:07 +00:00
|
|
|
height?: number;
|
2022-08-10 09:56:24 +00:00
|
|
|
lastMediaEvent?: string;
|
|
|
|
participantId?: string;
|
|
|
|
resolution?: number;
|
|
|
|
seeWhatIsBeingShared?: boolean;
|
2022-09-05 09:05:07 +00:00
|
|
|
width?: number;
|
2022-08-10 09:56:24 +00:00
|
|
|
}
|
|
|
|
|
2022-09-05 09:05:07 +00:00
|
|
|
ReducerRegistry.register<ILargeVideoState>('features/large-video', (state = {}, action): ILargeVideoState => {
|
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
|
|
|
|
2022-08-16 11:56:47 +00:00
|
|
|
case SET_LARGE_VIDEO_DIMENSIONS:
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
height: action.height,
|
|
|
|
width: action.width
|
|
|
|
};
|
|
|
|
|
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;
|
|
|
|
});
|