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.

reducer.js 1.0KB

12345678910111213141516171819202122232425262728293031
  1. import { PARTICIPANT_ID_CHANGED } from '../base/participants';
  2. import { ReducerRegistry } from '../base/redux';
  3. import { SELECT_LARGE_VIDEO_PARTICIPANT } from './actionTypes';
  4. ReducerRegistry.register('features/large-video', (state = {}, action) => {
  5. switch (action.type) {
  6. // When conference is joined, we update ID of local participant from default
  7. // 'local' to real ID. However, in large video we might have already
  8. // selected 'local' as participant on stage. So in this case we must update
  9. // ID of participant on stage to match ID in 'participants' state to avoid
  10. // additional changes in state and (re)renders.
  11. case PARTICIPANT_ID_CHANGED:
  12. if (state.participantId === action.oldValue) {
  13. return {
  14. ...state,
  15. participantId: action.newValue
  16. };
  17. }
  18. break;
  19. case SELECT_LARGE_VIDEO_PARTICIPANT:
  20. return {
  21. ...state,
  22. participantId: action.participantId
  23. };
  24. }
  25. return state;
  26. });