You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. import { PARTICIPANT_ID_CHANGED } from '../base/participants/actionTypes';
  2. import ReducerRegistry from '../base/redux/ReducerRegistry';
  3. import {
  4. SELECT_LARGE_VIDEO_PARTICIPANT,
  5. SET_LARGE_VIDEO_DIMENSIONS,
  6. SET_SEE_WHAT_IS_BEING_SHARED,
  7. UPDATE_KNOWN_LARGE_VIDEO_RESOLUTION
  8. } from './actionTypes';
  9. export interface ILargeVideoState {
  10. height?: number;
  11. participantId?: string;
  12. resolution?: number;
  13. seeWhatIsBeingShared?: boolean;
  14. width?: number;
  15. }
  16. ReducerRegistry.register<ILargeVideoState>('features/large-video', (state = {}, action): ILargeVideoState => {
  17. switch (action.type) {
  18. // When conference is joined, we update ID of local participant from default
  19. // 'local' to real ID. However, in large video we might have already
  20. // selected 'local' as participant on stage. So in this case we must update
  21. // ID of participant on stage to match ID in 'participants' state to avoid
  22. // additional changes in state and (re)renders.
  23. case PARTICIPANT_ID_CHANGED:
  24. if (state.participantId === action.oldValue) {
  25. return {
  26. ...state,
  27. participantId: action.newValue
  28. };
  29. }
  30. break;
  31. case SELECT_LARGE_VIDEO_PARTICIPANT:
  32. return {
  33. ...state,
  34. participantId: action.participantId
  35. };
  36. case SET_LARGE_VIDEO_DIMENSIONS:
  37. return {
  38. ...state,
  39. height: action.height,
  40. width: action.width
  41. };
  42. case UPDATE_KNOWN_LARGE_VIDEO_RESOLUTION:
  43. return {
  44. ...state,
  45. resolution: action.resolution
  46. };
  47. case SET_SEE_WHAT_IS_BEING_SHARED:
  48. return {
  49. ...state,
  50. seeWhatIsBeingShared: action.seeWhatIsBeingShared
  51. };
  52. }
  53. return state;
  54. });