Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

[RN] Add ability to start a call in audio-only mode

Saúl Ibarra Corretgéd03a81557259
diff --git a/react/features/base/media/middleware.js b/react/features/base/media/middleware.js
index c80bbebe2a..a5adfb74d7 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);
}