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.

12345678910111213141516171819202122232425262728293031
  1. // @flow
  2. import { VIDEO_QUALITY_LEVELS } from '../base/conference';
  3. import logger from './logger';
  4. import type { Dispatch } from 'redux';
  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. }