Saúl Ibarra Corretgé 7d513738d2 rn,flags: add ability to override resolution using a flag
Also, use the configured resolution to set it as the max received frame size.
2020-07-09 08:40:56 +02:00

34 lines
972 B
JavaScript

// @flow
import { CONFERENCE_JOINED } from '../base/conference/actionTypes';
import { setPreferredVideoQuality } from '../base/conference/actions';
import { MiddlewareRegistry } from '../base/redux';
import logger from './logger';
/**
* Implements the middleware of the feature video-quality.
*
* @param {Store} store - The redux store.
* @returns {Function}
*/
MiddlewareRegistry.register(({ dispatch, getState }) => next => action => {
const result = next(action);
switch (action.type) {
case CONFERENCE_JOINED: {
if (navigator.product === 'ReactNative') {
const { resolution } = getState()['features/base/config'];
if (typeof resolution !== 'undefined') {
dispatch(setPreferredVideoQuality(Number.parseInt(resolution, 10)));
logger.info(`Configured preferred receiver video frame height to: ${resolution}`);
}
}
break;
}
}
return result;
});