rn,tracks: do not load stream effects on mobile

This commit is contained in:
Saúl Ibarra Corretgé 2020-01-28 11:06:03 +01:00 committed by Saúl Ibarra Corretgé
parent 385669cbb8
commit c05b4a43e8
3 changed files with 49 additions and 23 deletions

View File

@ -1,7 +1,5 @@
/* global APP */
import { createScreenshotCaptureEffect } from '../../stream-effects/screenshot-capture';
import { getBlurEffect } from '../../blur';
import JitsiMeetJS, { JitsiTrackErrors, browser } from '../lib-jitsi-meet';
import { MEDIA_TYPE } from '../media';
import {
@ -9,6 +7,7 @@ import {
getUserSelectedMicDeviceId
} from '../settings';
import loadEffects from './loadEffects';
import logger from './logger';
/**
@ -94,29 +93,10 @@ export function createLocalTracksF(options = {}, firePermissionPromptIsShownEven
firefox_fake_device, // eslint-disable-line camelcase
resolution
} = state['features/base/config'];
const constraints = options.constraints
?? state['features/base/config'].constraints;
const blurPromise = state['features/blur'].blurEnabled
? getBlurEffect()
.catch(error => {
logger.error('Failed to obtain the blur effect instance with error: ', error);
return Promise.resolve();
})
: Promise.resolve();
const screenshotCapturePromise = state['features/screenshot-capture']?.capturesEnabled
? createScreenshotCaptureEffect(state)
.catch(error => {
logger.error('Failed to obtain the screenshot capture effect effect instance with error: ', error);
return Promise.resolve();
})
: Promise.resolve();
const loadEffectsPromise = Promise.all([ blurPromise, screenshotCapturePromise ]);
const constraints = options.constraints ?? state['features/base/config'].constraints;
return (
loadEffectsPromise.then(effectsArray => {
loadEffects(store).then(effectsArray => {
// Filter any undefined values returned by Promise.resolve().
const effects = effectsArray.filter(effect => Boolean(effect));

View File

@ -0,0 +1,11 @@
// @flow
/**
* Loads the enabled stream effects.
*
* @param {Object} store - The Redux store.
* @returns {Promsie} - A Promise which resolves when all effects are created.
*/
export default function loadEffects(store: Object): Promise<any> { // eslint-disable-line no-unused-vars
return Promise.resolve();
}

View File

@ -0,0 +1,35 @@
// @flow
import { createScreenshotCaptureEffect } from '../../stream-effects/screenshot-capture';
import { getBlurEffect } from '../../blur';
import logger from './logger';
/**
* Loads the enabled stream effects.
*
* @param {Object} store - The Redux store.
* @returns {Promsie} - A Promise which resolves when all effects are created.
*/
export default function loadEffects(store: Object): Promise<any> {
const state = store.getState();
const blurPromise = state['features/blur'].blurEnabled
? getBlurEffect()
.catch(error => {
logger.error('Failed to obtain the blur effect instance with error: ', error);
return Promise.resolve();
})
: Promise.resolve();
const screenshotCapturePromise = state['features/screenshot-capture']?.capturesEnabled
? createScreenshotCaptureEffect(state)
.catch(error => {
logger.error('Failed to obtain the screenshot capture effect effect instance with error: ', error);
return Promise.resolve();
})
: Promise.resolve();
return Promise.all([ blurPromise, screenshotCapturePromise ]);
}