From d03a815572592e2d2aabdf99410e138586065760 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Ibarra=20Corretg=C3=A9?= Date: Fri, 8 Sep 2017 16:03:27 +0200 Subject: [PATCH] [RN] Add ability to start a call in audio-only mode --- react/features/base/media/middleware.js | 26 ++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/react/features/base/media/middleware.js b/react/features/base/media/middleware.js index c80bbebe2..a5adfb74d 100644 --- a/react/features/base/media/middleware.js +++ b/react/features/base/media/middleware.js @@ -1,6 +1,6 @@ /* @flow */ -import { SET_ROOM } from '../conference'; +import { SET_ROOM, setAudioOnly } from '../conference'; import { parseURLParams } from '../config'; import { MiddlewareRegistry } from '../redux'; import { setTrackMuted, TRACK_ADDED } from '../tracks'; @@ -48,31 +48,38 @@ MiddlewareRegistry.register(store => next => action => { function _setRoom({ dispatch, getState }, next, action) { const state = getState(); let audioMuted; + let audioOnly; let videoMuted; if (action.room) { // The Jitsi Meet client may override the Jitsi Meet deployment on the - // subject of startWithAudioMuted and/or startWithVideoMuted in the - // (location) URL. + // subject of these: + // - startAudioOnly + // - startWithAudioMuted + // - startWithVideoMuted + // in the (location) URL. const urlParams = parseURLParams(state['features/base/connection'].locationURL); audioMuted = urlParams['config.startWithAudioMuted']; + audioOnly = urlParams['config.startAudioOnly']; videoMuted = urlParams['config.startWithVideoMuted']; } - // Of course, the Jitsi Meet deployment may define startWithAudioMuted - // and/or startWithVideoMuted through config.js which should be respected if - // the client did not override it. + // Of course, the Jitsi Meet deployment may define those options through + // config.js which should be respected if the client did not override it. const config = state['features/base/config']; typeof audioMuted === 'undefined' && (audioMuted = config.startWithAudioMuted); + typeof audioOnly === 'undefined' + && (audioOnly = config.startAudioOnly); typeof videoMuted === 'undefined' && (videoMuted = config.startWithVideoMuted); - // Apply startWithAudioMuted and startWithVideoMuted. + // Apply options. audioMuted = Boolean(audioMuted); + audioOnly = Boolean(audioOnly); videoMuted = Boolean(videoMuted); // Unconditionally express the desires/expectations/intents of the app and @@ -82,6 +89,11 @@ function _setRoom({ dispatch, getState }, next, action) { dispatch(setCameraFacingMode(CAMERA_FACING_MODE.USER)); dispatch(setVideoMuted(videoMuted)); + // Apply starAudioOnly if we are joining a conference + if (action.room) { + dispatch(setAudioOnly(audioOnly)); + } + return next(action); }