瀏覽代碼

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

j8
Saúl Ibarra Corretgé 8 年之前
父節點
當前提交
d03a815572
共有 1 個檔案被更改,包括 19 行新增7 行删除
  1. 19
    7
      react/features/base/media/middleware.js

+ 19
- 7
react/features/base/media/middleware.js 查看文件

1
 /* @flow */
1
 /* @flow */
2
 
2
 
3
-import { SET_ROOM } from '../conference';
3
+import { SET_ROOM, setAudioOnly } from '../conference';
4
 import { parseURLParams } from '../config';
4
 import { parseURLParams } from '../config';
5
 import { MiddlewareRegistry } from '../redux';
5
 import { MiddlewareRegistry } from '../redux';
6
 import { setTrackMuted, TRACK_ADDED } from '../tracks';
6
 import { setTrackMuted, TRACK_ADDED } from '../tracks';
48
 function _setRoom({ dispatch, getState }, next, action) {
48
 function _setRoom({ dispatch, getState }, next, action) {
49
     const state = getState();
49
     const state = getState();
50
     let audioMuted;
50
     let audioMuted;
51
+    let audioOnly;
51
     let videoMuted;
52
     let videoMuted;
52
 
53
 
53
     if (action.room) {
54
     if (action.room) {
54
         // The Jitsi Meet client may override the Jitsi Meet deployment on the
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
         const urlParams
61
         const urlParams
58
             = parseURLParams(state['features/base/connection'].locationURL);
62
             = parseURLParams(state['features/base/connection'].locationURL);
59
 
63
 
60
         audioMuted = urlParams['config.startWithAudioMuted'];
64
         audioMuted = urlParams['config.startWithAudioMuted'];
65
+        audioOnly = urlParams['config.startAudioOnly'];
61
         videoMuted = urlParams['config.startWithVideoMuted'];
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
     const config = state['features/base/config'];
71
     const config = state['features/base/config'];
68
 
72
 
69
     typeof audioMuted === 'undefined'
73
     typeof audioMuted === 'undefined'
70
         && (audioMuted = config.startWithAudioMuted);
74
         && (audioMuted = config.startWithAudioMuted);
75
+    typeof audioOnly === 'undefined'
76
+        && (audioOnly = config.startAudioOnly);
71
     typeof videoMuted === 'undefined'
77
     typeof videoMuted === 'undefined'
72
         && (videoMuted = config.startWithVideoMuted);
78
         && (videoMuted = config.startWithVideoMuted);
73
 
79
 
74
-    // Apply startWithAudioMuted and startWithVideoMuted.
80
+    // Apply options.
75
     audioMuted = Boolean(audioMuted);
81
     audioMuted = Boolean(audioMuted);
82
+    audioOnly = Boolean(audioOnly);
76
     videoMuted = Boolean(videoMuted);
83
     videoMuted = Boolean(videoMuted);
77
 
84
 
78
     // Unconditionally express the desires/expectations/intents of the app and
85
     // Unconditionally express the desires/expectations/intents of the app and
82
     dispatch(setCameraFacingMode(CAMERA_FACING_MODE.USER));
89
     dispatch(setCameraFacingMode(CAMERA_FACING_MODE.USER));
83
     dispatch(setVideoMuted(videoMuted));
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
     return next(action);
97
     return next(action);
86
 }
98
 }
87
 
99
 

Loading…
取消
儲存