Bläddra i källkod

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

j8
Saúl Ibarra Corretgé 8 år sedan
förälder
incheckning
d03a815572
1 ändrade filer med 19 tillägg och 7 borttagningar
  1. 19
    7
      react/features/base/media/middleware.js

+ 19
- 7
react/features/base/media/middleware.js Visa fil

@@ -1,6 +1,6 @@
1 1
 /* @flow */
2 2
 
3
-import { SET_ROOM } from '../conference';
3
+import { SET_ROOM, setAudioOnly } from '../conference';
4 4
 import { parseURLParams } from '../config';
5 5
 import { MiddlewareRegistry } from '../redux';
6 6
 import { setTrackMuted, TRACK_ADDED } from '../tracks';
@@ -48,31 +48,38 @@ MiddlewareRegistry.register(store => next => action => {
48 48
 function _setRoom({ dispatch, getState }, next, action) {
49 49
     const state = getState();
50 50
     let audioMuted;
51
+    let audioOnly;
51 52
     let videoMuted;
52 53
 
53 54
     if (action.room) {
54 55
         // The Jitsi Meet client may override the Jitsi Meet deployment on the
55
-        // subject of startWithAudioMuted and/or startWithVideoMuted in the
56
-        // (location) URL.
56
+        // subject of these:
57
+        //  - startAudioOnly
58
+        //  - startWithAudioMuted
59
+        //  - startWithVideoMuted
60
+        // in the (location) URL.
57 61
         const urlParams
58 62
             = parseURLParams(state['features/base/connection'].locationURL);
59 63
 
60 64
         audioMuted = urlParams['config.startWithAudioMuted'];
65
+        audioOnly = urlParams['config.startAudioOnly'];
61 66
         videoMuted = urlParams['config.startWithVideoMuted'];
62 67
     }
63 68
 
64
-    // Of course, the Jitsi Meet deployment may define startWithAudioMuted
65
-    // and/or startWithVideoMuted through config.js which should be respected if
66
-    // the client did not override it.
69
+    // Of course, the Jitsi Meet deployment may define those options through
70
+    // config.js which should be respected if the client did not override it.
67 71
     const config = state['features/base/config'];
68 72
 
69 73
     typeof audioMuted === 'undefined'
70 74
         && (audioMuted = config.startWithAudioMuted);
75
+    typeof audioOnly === 'undefined'
76
+        && (audioOnly = config.startAudioOnly);
71 77
     typeof videoMuted === 'undefined'
72 78
         && (videoMuted = config.startWithVideoMuted);
73 79
 
74
-    // Apply startWithAudioMuted and startWithVideoMuted.
80
+    // Apply options.
75 81
     audioMuted = Boolean(audioMuted);
82
+    audioOnly = Boolean(audioOnly);
76 83
     videoMuted = Boolean(videoMuted);
77 84
 
78 85
     // Unconditionally express the desires/expectations/intents of the app and
@@ -82,6 +89,11 @@ function _setRoom({ dispatch, getState }, next, action) {
82 89
     dispatch(setCameraFacingMode(CAMERA_FACING_MODE.USER));
83 90
     dispatch(setVideoMuted(videoMuted));
84 91
 
92
+    // Apply starAudioOnly if we are joining a conference
93
+    if (action.room) {
94
+        dispatch(setAudioOnly(audioOnly));
95
+    }
96
+
85 97
     return next(action);
86 98
 }
87 99
 

Laddar…
Avbryt
Spara