2017-10-04 22:36:09 +00:00
|
|
|
// @flow
|
|
|
|
|
2017-12-11 18:48:32 +00:00
|
|
|
import {
|
2018-01-03 21:24:07 +00:00
|
|
|
ACTION_PINNED,
|
|
|
|
ACTION_UNPINNED,
|
2018-02-02 14:50:16 +00:00
|
|
|
createAudioOnlyChangedEvent,
|
2018-01-03 21:24:07 +00:00
|
|
|
createPinnedEvent,
|
|
|
|
sendAnalytics
|
2017-12-11 18:48:32 +00:00
|
|
|
} from '../../analytics';
|
2016-12-05 15:14:50 +00:00
|
|
|
import { CONNECTION_ESTABLISHED } from '../connection';
|
2017-08-02 15:00:51 +00:00
|
|
|
import { setVideoMuted, VIDEO_MUTISM_AUTHORITY } from '../media';
|
2016-10-05 14:36:59 +00:00
|
|
|
import {
|
|
|
|
getLocalParticipant,
|
|
|
|
getParticipantById,
|
2017-06-27 22:56:55 +00:00
|
|
|
getPinnedParticipant,
|
2016-10-05 14:36:59 +00:00
|
|
|
PIN_PARTICIPANT
|
|
|
|
} from '../participants';
|
|
|
|
import { MiddlewareRegistry } from '../redux';
|
2018-02-13 17:58:26 +00:00
|
|
|
import UIEvents from '../../../../service/UI/UIEvents';
|
2018-03-01 19:46:11 +00:00
|
|
|
import { TRACK_ADDED, TRACK_REMOVED } from '../tracks';
|
2016-10-05 14:36:59 +00:00
|
|
|
|
2017-03-29 12:07:05 +00:00
|
|
|
import {
|
|
|
|
createConference,
|
2017-08-02 15:00:51 +00:00
|
|
|
setAudioOnly,
|
2017-08-09 19:40:03 +00:00
|
|
|
setLastN,
|
|
|
|
toggleAudioOnly
|
2017-03-29 12:07:05 +00:00
|
|
|
} from './actions';
|
2017-08-02 15:00:51 +00:00
|
|
|
import {
|
|
|
|
CONFERENCE_FAILED,
|
|
|
|
CONFERENCE_JOINED,
|
|
|
|
CONFERENCE_LEFT,
|
2017-08-09 19:40:03 +00:00
|
|
|
DATA_CHANNEL_OPENED,
|
2017-08-02 15:00:51 +00:00
|
|
|
SET_AUDIO_ONLY,
|
2017-08-09 19:40:03 +00:00
|
|
|
SET_LASTN,
|
|
|
|
SET_RECEIVE_VIDEO_QUALITY
|
2017-08-02 15:00:51 +00:00
|
|
|
} from './actionTypes';
|
2016-10-05 14:36:59 +00:00
|
|
|
import {
|
|
|
|
_addLocalTracksToConference,
|
|
|
|
_handleParticipantError,
|
|
|
|
_removeLocalTracksFromConference
|
|
|
|
} from './functions';
|
|
|
|
|
2017-10-09 21:40:38 +00:00
|
|
|
const logger = require('jitsi-meet-logger').getLogger(__filename);
|
|
|
|
|
2017-10-04 22:36:09 +00:00
|
|
|
declare var APP: Object;
|
|
|
|
|
2016-10-05 14:36:59 +00:00
|
|
|
/**
|
2016-12-05 15:14:50 +00:00
|
|
|
* Implements the middleware of the feature base/conference.
|
2016-10-05 14:36:59 +00:00
|
|
|
*
|
2017-08-04 21:06:42 +00:00
|
|
|
* @param {Store} store - The redux store.
|
2016-10-05 14:36:59 +00:00
|
|
|
* @returns {Function}
|
|
|
|
*/
|
|
|
|
MiddlewareRegistry.register(store => next => action => {
|
|
|
|
switch (action.type) {
|
2016-12-05 15:14:50 +00:00
|
|
|
case CONNECTION_ESTABLISHED:
|
|
|
|
return _connectionEstablished(store, next, action);
|
|
|
|
|
2017-08-02 15:00:51 +00:00
|
|
|
case CONFERENCE_FAILED:
|
|
|
|
case CONFERENCE_LEFT:
|
|
|
|
return _conferenceFailedOrLeft(store, next, action);
|
|
|
|
|
2017-08-04 21:06:42 +00:00
|
|
|
case CONFERENCE_JOINED:
|
|
|
|
return _conferenceJoined(store, next, action);
|
|
|
|
|
2017-08-09 19:40:03 +00:00
|
|
|
case DATA_CHANNEL_OPENED:
|
|
|
|
return _syncReceiveVideoQuality(store, next, action);
|
|
|
|
|
2016-10-05 14:36:59 +00:00
|
|
|
case PIN_PARTICIPANT:
|
2016-12-05 15:14:50 +00:00
|
|
|
return _pinParticipant(store, next, action);
|
2016-10-05 14:36:59 +00:00
|
|
|
|
2017-03-29 12:07:05 +00:00
|
|
|
case SET_AUDIO_ONLY:
|
|
|
|
return _setAudioOnly(store, next, action);
|
|
|
|
|
2017-03-29 10:24:18 +00:00
|
|
|
case SET_LASTN:
|
|
|
|
return _setLastN(store, next, action);
|
|
|
|
|
2017-08-09 19:40:03 +00:00
|
|
|
case SET_RECEIVE_VIDEO_QUALITY:
|
|
|
|
return _setReceiveVideoQuality(store, next, action);
|
|
|
|
|
2016-10-05 14:36:59 +00:00
|
|
|
case TRACK_ADDED:
|
2016-12-05 15:14:50 +00:00
|
|
|
case TRACK_REMOVED:
|
|
|
|
return _trackAddedOrRemoved(store, next, action);
|
2016-10-05 14:36:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return next(action);
|
|
|
|
});
|
|
|
|
|
|
|
|
/**
|
2016-12-05 15:14:50 +00:00
|
|
|
* Notifies the feature base/conference that the action CONNECTION_ESTABLISHED
|
2017-08-04 21:06:42 +00:00
|
|
|
* is being dispatched within a specific redux store.
|
2016-10-05 14:36:59 +00:00
|
|
|
*
|
2017-08-04 21:06:42 +00:00
|
|
|
* @param {Store} store - The redux store in which the specified action is being
|
2016-12-05 15:14:50 +00:00
|
|
|
* dispatched.
|
2017-08-04 21:06:42 +00:00
|
|
|
* @param {Dispatch} next - The redux dispatch function to dispatch the
|
2016-12-05 15:14:50 +00:00
|
|
|
* specified action to the specified store.
|
2017-08-04 21:06:42 +00:00
|
|
|
* @param {Action} action - The redux action CONNECTION_ESTABLISHED which is
|
2016-12-05 15:14:50 +00:00
|
|
|
* being dispatched in the specified store.
|
|
|
|
* @private
|
2018-02-13 17:58:26 +00:00
|
|
|
* @returns {Object} The value returned by {@code next(action)}.
|
2016-12-05 15:14:50 +00:00
|
|
|
*/
|
2018-02-13 17:58:26 +00:00
|
|
|
function _connectionEstablished({ dispatch }, next, action) {
|
2016-12-05 15:14:50 +00:00
|
|
|
const result = next(action);
|
|
|
|
|
2017-01-31 20:58:48 +00:00
|
|
|
// FIXME: workaround for the web version. Currently the creation of the
|
|
|
|
// conference is handled by /conference.js
|
2017-02-20 09:36:46 +00:00
|
|
|
if (typeof APP === 'undefined') {
|
2018-02-13 17:58:26 +00:00
|
|
|
dispatch(createConference());
|
2017-01-31 20:58:48 +00:00
|
|
|
}
|
2016-12-05 15:14:50 +00:00
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2017-08-02 15:00:51 +00:00
|
|
|
/**
|
2017-08-04 21:06:42 +00:00
|
|
|
* Does extra sync up on properties that may need to be updated after the
|
|
|
|
* conference failed or was left.
|
2017-08-02 15:00:51 +00:00
|
|
|
*
|
2017-08-04 21:06:42 +00:00
|
|
|
* @param {Store} store - The redux store in which the specified action is being
|
2017-08-02 15:00:51 +00:00
|
|
|
* dispatched.
|
2017-08-04 21:06:42 +00:00
|
|
|
* @param {Dispatch} next - The redux dispatch function to dispatch the
|
2017-08-02 15:00:51 +00:00
|
|
|
* specified action to the specified store.
|
2017-08-04 21:06:42 +00:00
|
|
|
* @param {Action} action - The redux action {@link CONFERENCE_FAILED} or
|
2017-08-02 15:00:51 +00:00
|
|
|
* {@link CONFERENCE_LEFT} which is being dispatched in the specified store.
|
|
|
|
* @private
|
2018-02-13 17:58:26 +00:00
|
|
|
* @returns {Object} The value returned by {@code next(action)}.
|
2017-08-02 15:00:51 +00:00
|
|
|
*/
|
2017-08-04 21:06:42 +00:00
|
|
|
function _conferenceFailedOrLeft({ dispatch, getState }, next, action) {
|
2017-08-02 15:00:51 +00:00
|
|
|
const result = next(action);
|
2018-02-26 16:14:46 +00:00
|
|
|
|
2018-02-02 14:50:16 +00:00
|
|
|
const state = getState();
|
|
|
|
const { audioOnly } = state['features/base/conference'];
|
2018-02-27 20:21:28 +00:00
|
|
|
const { startAudioOnly } = state['features/base/profile'];
|
2018-02-02 14:50:16 +00:00
|
|
|
|
2018-02-26 16:14:46 +00:00
|
|
|
// FIXME: Consider implementing a standalone audio-only feature that handles
|
|
|
|
// all these state changes.
|
|
|
|
if (audioOnly) {
|
|
|
|
if (!startAudioOnly) {
|
|
|
|
sendAnalytics(createAudioOnlyChangedEvent(false));
|
|
|
|
logger.log('Audio only disabled');
|
|
|
|
dispatch(setAudioOnly(false));
|
|
|
|
}
|
|
|
|
} else if (startAudioOnly) {
|
2018-02-02 14:50:16 +00:00
|
|
|
sendAnalytics(createAudioOnlyChangedEvent(true));
|
|
|
|
logger.log('Audio only enabled');
|
|
|
|
dispatch(setAudioOnly(true));
|
2017-10-09 21:40:38 +00:00
|
|
|
}
|
2017-08-02 15:00:51 +00:00
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2017-07-11 13:06:58 +00:00
|
|
|
/**
|
2017-08-04 21:06:42 +00:00
|
|
|
* Does extra sync up on properties that may need to be updated after the
|
|
|
|
* conference was joined.
|
2017-07-11 13:06:58 +00:00
|
|
|
*
|
2017-08-04 21:06:42 +00:00
|
|
|
* @param {Store} store - The redux store in which the specified action is being
|
2017-07-11 13:06:58 +00:00
|
|
|
* dispatched.
|
2017-08-04 21:06:42 +00:00
|
|
|
* @param {Dispatch} next - The redux dispatch function to dispatch the
|
2017-07-11 13:06:58 +00:00
|
|
|
* specified action to the specified store.
|
2017-08-04 21:06:42 +00:00
|
|
|
* @param {Action} action - The redux action CONFERENCE_JOINED which is being
|
2017-07-11 13:06:58 +00:00
|
|
|
* dispatched in the specified store.
|
|
|
|
* @private
|
2018-02-13 17:58:26 +00:00
|
|
|
* @returns {Object} The value returned by {@code next(action)}.
|
2017-07-11 13:06:58 +00:00
|
|
|
*/
|
2018-02-13 17:58:26 +00:00
|
|
|
function _conferenceJoined({ dispatch, getState }, next, action) {
|
2017-07-11 13:06:58 +00:00
|
|
|
const result = next(action);
|
2018-02-13 17:58:26 +00:00
|
|
|
|
|
|
|
const { audioOnly, conference } = getState()['features/base/conference'];
|
2017-07-11 13:06:58 +00:00
|
|
|
|
|
|
|
// FIXME On Web the audio only mode for "start audio only" is toggled before
|
|
|
|
// conference is added to the redux store ("on conference joined" action)
|
|
|
|
// and the LastN value needs to be synchronized here.
|
2018-02-13 17:58:26 +00:00
|
|
|
audioOnly && (conference.getLastN() !== 0) && dispatch(setLastN(0));
|
2017-07-11 13:06:58 +00:00
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2016-12-05 15:14:50 +00:00
|
|
|
/**
|
|
|
|
* Notifies the feature base/conference that the action PIN_PARTICIPANT is being
|
2017-08-04 21:06:42 +00:00
|
|
|
* dispatched within a specific redux store. Pins the specified remote
|
2016-12-05 15:14:50 +00:00
|
|
|
* participant in the associated conference, ignores the local participant.
|
|
|
|
*
|
2017-08-04 21:06:42 +00:00
|
|
|
* @param {Store} store - The redux store in which the specified action is being
|
2016-12-05 15:14:50 +00:00
|
|
|
* dispatched.
|
2017-08-04 21:06:42 +00:00
|
|
|
* @param {Dispatch} next - The redux dispatch function to dispatch the
|
2016-12-05 15:14:50 +00:00
|
|
|
* specified action to the specified store.
|
2017-08-04 21:06:42 +00:00
|
|
|
* @param {Action} action - The redux action PIN_PARTICIPANT which is being
|
2016-12-05 15:14:50 +00:00
|
|
|
* dispatched in the specified store.
|
|
|
|
* @private
|
2018-02-13 17:58:26 +00:00
|
|
|
* @returns {Object} The value returned by {@code next(action)}.
|
2016-10-05 14:36:59 +00:00
|
|
|
*/
|
2018-02-13 17:58:26 +00:00
|
|
|
function _pinParticipant({ getState }, next, action) {
|
|
|
|
const state = getState();
|
2017-06-27 22:56:55 +00:00
|
|
|
const { conference } = state['features/base/conference'];
|
2018-01-31 16:37:41 +00:00
|
|
|
|
|
|
|
if (!conference) {
|
|
|
|
return next(action);
|
|
|
|
}
|
|
|
|
|
2016-10-05 14:36:59 +00:00
|
|
|
const participants = state['features/base/participants'];
|
2016-12-05 15:14:50 +00:00
|
|
|
const id = action.participant.id;
|
2016-10-05 14:36:59 +00:00
|
|
|
const participantById = getParticipantById(participants, id);
|
|
|
|
|
2017-08-10 20:51:35 +00:00
|
|
|
if (typeof APP !== 'undefined') {
|
2017-06-27 22:56:55 +00:00
|
|
|
const pinnedParticipant = getPinnedParticipant(participants);
|
2018-01-31 16:37:41 +00:00
|
|
|
const actionName = id ? ACTION_PINNED : ACTION_UNPINNED;
|
|
|
|
const local
|
|
|
|
= (participantById && participantById.local)
|
2018-01-03 21:24:07 +00:00
|
|
|
|| (!id && pinnedParticipant && pinnedParticipant.local);
|
|
|
|
|
|
|
|
sendAnalytics(createPinnedEvent(
|
|
|
|
actionName,
|
|
|
|
local ? 'local' : id,
|
|
|
|
{
|
2018-01-31 16:37:41 +00:00
|
|
|
local,
|
|
|
|
'participant_count': conference.getParticipantCount()
|
2018-01-03 21:24:07 +00:00
|
|
|
}));
|
2017-06-27 22:56:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// The following condition prevents signaling to pin local participant and
|
|
|
|
// shared videos. The logic is:
|
2016-10-05 14:36:59 +00:00
|
|
|
// - If we have an ID, we check if the participant identified by that ID is
|
2017-06-27 22:56:55 +00:00
|
|
|
// local or a bot/fake participant (such as with shared video).
|
2016-10-05 14:36:59 +00:00
|
|
|
// - If we don't have an ID (i.e. no participant identified by an ID), we
|
|
|
|
// check for local participant. If she's currently pinned, then this
|
|
|
|
// action will unpin her and that's why we won't signal here too.
|
2018-01-31 16:37:41 +00:00
|
|
|
let pin;
|
|
|
|
|
2016-10-05 14:36:59 +00:00
|
|
|
if (participantById) {
|
2017-06-27 22:56:55 +00:00
|
|
|
pin = !participantById.local && !participantById.isBot;
|
2016-10-05 14:36:59 +00:00
|
|
|
} else {
|
|
|
|
const localParticipant = getLocalParticipant(participants);
|
|
|
|
|
|
|
|
pin = !localParticipant || !localParticipant.pinned;
|
|
|
|
}
|
|
|
|
if (pin) {
|
|
|
|
try {
|
|
|
|
conference.pinParticipant(id);
|
|
|
|
} catch (err) {
|
|
|
|
_handleParticipantError(err);
|
|
|
|
}
|
|
|
|
}
|
2016-12-05 15:14:50 +00:00
|
|
|
|
|
|
|
return next(action);
|
|
|
|
}
|
|
|
|
|
2017-03-29 12:07:05 +00:00
|
|
|
/**
|
|
|
|
* Sets the audio-only flag for the current conference. When audio-only is set,
|
|
|
|
* local video is muted and last N is set to 0 to avoid receiving remote video.
|
|
|
|
*
|
2017-08-04 21:06:42 +00:00
|
|
|
* @param {Store} store - The redux store in which the specified action is being
|
2017-03-29 12:07:05 +00:00
|
|
|
* dispatched.
|
2017-08-04 21:06:42 +00:00
|
|
|
* @param {Dispatch} next - The redux dispatch function to dispatch the
|
2017-03-29 12:07:05 +00:00
|
|
|
* specified action to the specified store.
|
2017-08-04 21:06:42 +00:00
|
|
|
* @param {Action} action - The redux action SET_AUDIO_ONLY which is being
|
2017-03-29 12:07:05 +00:00
|
|
|
* dispatched in the specified store.
|
|
|
|
* @private
|
2018-02-13 17:58:26 +00:00
|
|
|
* @returns {Object} The value returned by {@code next(action)}.
|
2017-03-29 12:07:05 +00:00
|
|
|
*/
|
2017-08-04 21:06:42 +00:00
|
|
|
function _setAudioOnly({ dispatch, getState }, next, action) {
|
2017-03-29 12:07:05 +00:00
|
|
|
const result = next(action);
|
|
|
|
|
2017-08-04 21:06:42 +00:00
|
|
|
const { audioOnly } = getState()['features/base/conference'];
|
2017-03-29 12:07:05 +00:00
|
|
|
|
|
|
|
// Set lastN to 0 in case audio-only is desired; leave it as undefined,
|
|
|
|
// otherwise, and the default lastN value will be chosen automatically.
|
2017-08-02 15:00:51 +00:00
|
|
|
dispatch(setLastN(audioOnly ? 0 : undefined));
|
2017-03-29 12:07:05 +00:00
|
|
|
|
2017-08-04 21:06:42 +00:00
|
|
|
// Mute/unmute the local video.
|
2017-08-14 13:27:24 +00:00
|
|
|
dispatch(
|
|
|
|
setVideoMuted(
|
|
|
|
audioOnly,
|
|
|
|
VIDEO_MUTISM_AUTHORITY.AUDIO_ONLY,
|
|
|
|
/* ensureTrack */ true));
|
2017-03-29 12:07:05 +00:00
|
|
|
|
2017-04-05 15:14:26 +00:00
|
|
|
if (typeof APP !== 'undefined') {
|
|
|
|
// TODO This should be a temporary solution that lasts only until
|
|
|
|
// video tracks and all ui is moved into react/redux on the web.
|
|
|
|
APP.UI.emitEvent(UIEvents.TOGGLE_AUDIO_ONLY, audioOnly);
|
|
|
|
}
|
|
|
|
|
2017-03-29 12:07:05 +00:00
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2017-03-29 10:24:18 +00:00
|
|
|
/**
|
|
|
|
* Sets the last N (value) of the video channel in the conference.
|
|
|
|
*
|
2017-08-04 21:06:42 +00:00
|
|
|
* @param {Store} store - The redux store in which the specified action is being
|
2017-03-29 10:24:18 +00:00
|
|
|
* dispatched.
|
2017-08-04 21:06:42 +00:00
|
|
|
* @param {Dispatch} next - The redux dispatch function to dispatch the
|
2017-03-29 10:24:18 +00:00
|
|
|
* specified action to the specified store.
|
2017-08-04 21:06:42 +00:00
|
|
|
* @param {Action} action - The redux action SET_LASTN which is being dispatched
|
2017-03-29 10:24:18 +00:00
|
|
|
* in the specified store.
|
|
|
|
* @private
|
2018-02-13 17:58:26 +00:00
|
|
|
* @returns {Object} The value returned by {@code next(action)}.
|
2017-03-29 10:24:18 +00:00
|
|
|
*/
|
2018-02-13 17:58:26 +00:00
|
|
|
function _setLastN({ getState }, next, action) {
|
|
|
|
const { conference } = getState()['features/base/conference'];
|
2017-03-29 10:24:18 +00:00
|
|
|
|
|
|
|
if (conference) {
|
|
|
|
try {
|
|
|
|
conference.setLastN(action.lastN);
|
|
|
|
} catch (err) {
|
|
|
|
console.error(`Failed to set lastN: ${err}`);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return next(action);
|
|
|
|
}
|
|
|
|
|
2017-08-09 19:40:03 +00:00
|
|
|
/**
|
|
|
|
* Sets the maximum receive video quality and will turn off audio only mode if
|
|
|
|
* enabled.
|
|
|
|
*
|
2018-02-13 17:58:26 +00:00
|
|
|
* @param {Store} store - The redux store in which the specified action is being
|
2017-08-09 19:40:03 +00:00
|
|
|
* dispatched.
|
2018-02-13 17:58:26 +00:00
|
|
|
* @param {Dispatch} next - The redux dispatch function to dispatch the
|
2017-08-09 19:40:03 +00:00
|
|
|
* specified action to the specified store.
|
2018-02-13 17:58:26 +00:00
|
|
|
* @param {Action} action - The redux action SET_RECEIVE_VIDEO_QUALITY which is
|
2017-08-09 19:40:03 +00:00
|
|
|
* being dispatched in the specified store.
|
|
|
|
* @private
|
2018-02-13 17:58:26 +00:00
|
|
|
* @returns {Object} The value returned by {@code next(action)}.
|
2017-08-09 19:40:03 +00:00
|
|
|
*/
|
2017-10-04 22:36:09 +00:00
|
|
|
function _setReceiveVideoQuality({ dispatch, getState }, next, action) {
|
|
|
|
const { audioOnly, conference } = getState()['features/base/conference'];
|
2017-08-09 19:40:03 +00:00
|
|
|
|
2018-01-31 16:41:12 +00:00
|
|
|
if (conference) {
|
|
|
|
conference.setReceiverVideoConstraint(action.receiveVideoQuality);
|
2018-02-13 17:58:26 +00:00
|
|
|
audioOnly && dispatch(toggleAudioOnly());
|
2017-08-09 19:40:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return next(action);
|
|
|
|
}
|
|
|
|
|
2016-12-12 00:29:13 +00:00
|
|
|
/**
|
|
|
|
* Synchronizes local tracks from state with local tracks in JitsiConference
|
|
|
|
* instance.
|
|
|
|
*
|
2017-08-04 21:06:42 +00:00
|
|
|
* @param {Store} store - The redux store.
|
2016-12-12 00:29:13 +00:00
|
|
|
* @param {Object} action - Action object.
|
|
|
|
* @private
|
|
|
|
* @returns {Promise}
|
|
|
|
*/
|
2017-10-04 22:36:09 +00:00
|
|
|
function _syncConferenceLocalTracksWithState({ getState }, action) {
|
|
|
|
const state = getState()['features/base/conference'];
|
|
|
|
const { conference } = state;
|
2016-12-12 00:29:13 +00:00
|
|
|
let promise;
|
|
|
|
|
|
|
|
// XXX The conference may already be in the process of being left, that's
|
|
|
|
// why we should not add/remove local tracks to such conference.
|
|
|
|
if (conference && conference !== state.leaving) {
|
|
|
|
const track = action.track.jitsiTrack;
|
|
|
|
|
|
|
|
if (action.type === TRACK_ADDED) {
|
|
|
|
promise = _addLocalTracksToConference(conference, [ track ]);
|
|
|
|
} else {
|
|
|
|
promise = _removeLocalTracksFromConference(conference, [ track ]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return promise || Promise.resolve();
|
|
|
|
}
|
|
|
|
|
2017-08-09 19:40:03 +00:00
|
|
|
/**
|
|
|
|
* Sets the maximum receive video quality.
|
|
|
|
*
|
2018-02-13 17:58:26 +00:00
|
|
|
* @param {Store} store - The redux store in which the specified action is being
|
2017-08-09 19:40:03 +00:00
|
|
|
* dispatched.
|
2018-02-13 17:58:26 +00:00
|
|
|
* @param {Dispatch} next - The redux dispatch function to dispatch the
|
2017-08-09 19:40:03 +00:00
|
|
|
* specified action to the specified store.
|
2018-02-13 17:58:26 +00:00
|
|
|
* @param {Action} action - The redux action DATA_CHANNEL_STATUS_CHANGED which
|
2017-08-09 19:40:03 +00:00
|
|
|
* is being dispatched in the specified store.
|
|
|
|
* @private
|
2018-02-13 17:58:26 +00:00
|
|
|
* @returns {Object} The value returned by {@code next(action)}.
|
2017-08-09 19:40:03 +00:00
|
|
|
*/
|
2017-10-04 22:36:09 +00:00
|
|
|
function _syncReceiveVideoQuality({ getState }, next, action) {
|
|
|
|
const state = getState()['features/base/conference'];
|
2017-08-09 19:40:03 +00:00
|
|
|
|
|
|
|
state.conference.setReceiverVideoConstraint(state.receiveVideoQuality);
|
|
|
|
|
|
|
|
return next(action);
|
|
|
|
}
|
|
|
|
|
2016-12-05 15:14:50 +00:00
|
|
|
/**
|
|
|
|
* Notifies the feature base/conference that the action TRACK_ADDED
|
2017-08-04 21:06:42 +00:00
|
|
|
* or TRACK_REMOVED is being dispatched within a specific redux store.
|
2016-12-05 15:14:50 +00:00
|
|
|
*
|
2017-08-04 21:06:42 +00:00
|
|
|
* @param {Store} store - The redux store in which the specified action is being
|
2016-12-05 15:14:50 +00:00
|
|
|
* dispatched.
|
2017-08-04 21:06:42 +00:00
|
|
|
* @param {Dispatch} next - The redux dispatch function to dispatch the
|
2016-12-05 15:14:50 +00:00
|
|
|
* specified action to the specified store.
|
2017-08-04 21:06:42 +00:00
|
|
|
* @param {Action} action - The redux action TRACK_ADDED or TRACK_REMOVED which
|
2016-12-05 15:14:50 +00:00
|
|
|
* is being dispatched in the specified store.
|
|
|
|
* @private
|
2018-02-13 17:58:26 +00:00
|
|
|
* @returns {Object} The value returned by {@code next(action)}.
|
2016-12-05 15:14:50 +00:00
|
|
|
*/
|
|
|
|
function _trackAddedOrRemoved(store, next, action) {
|
|
|
|
const track = action.track;
|
|
|
|
|
|
|
|
if (track && track.local) {
|
|
|
|
return (
|
|
|
|
_syncConferenceLocalTracksWithState(store, action)
|
|
|
|
.then(() => next(action)));
|
|
|
|
}
|
|
|
|
|
|
|
|
return next(action);
|
2016-10-05 14:36:59 +00:00
|
|
|
}
|