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.

actions.js 1.1KB

123456789101112131415161718192021222324252627282930313233
  1. // @flow
  2. import type { Dispatch } from 'redux';
  3. import { VIDEO_QUALITY_LEVELS } from '../base/conference';
  4. import logger from './logger';
  5. /**
  6. * Sets the maximum video size the local participant should send and receive from
  7. * remote participants.
  8. *
  9. * @param {number} frameHeight - The user preferred max frame height for send and
  10. * receive video.
  11. * @returns {void}
  12. */
  13. export function setVideoQuality(frameHeight: number) {
  14. return (dispatch: Dispatch<any>, getState: Function) => {
  15. const { conference, maxReceiverVideoQuality } = getState()['features/base/conference'];
  16. if (frameHeight < VIDEO_QUALITY_LEVELS.LOW) {
  17. logger.error(`Invalid frame height for video quality - ${frameHeight}`);
  18. return;
  19. }
  20. conference.setReceiverVideoConstraint(Math.min(frameHeight, maxReceiverVideoQuality));
  21. conference.setSenderVideoConstraint(Math.min(frameHeight, VIDEO_QUALITY_LEVELS.HIGH))
  22. .catch(err => {
  23. logger.error(`Set video quality command failed - ${err}`);
  24. });
  25. };
  26. }