瀏覽代碼

fix(conference) unify conference options

Some options were missing on the mobile side, notably calltsts
enableDisplayNameInStats and enableEmailInStats. Now the same logic will be used
in web and mobile.
master
Saúl Ibarra Corretgé 4 年之前
父節點
當前提交
465e7f1458

+ 7
- 2
conference.js 查看文件

39
     conferenceWillJoin,
39
     conferenceWillJoin,
40
     conferenceWillLeave,
40
     conferenceWillLeave,
41
     dataChannelOpened,
41
     dataChannelOpened,
42
+    getConferenceOptions,
42
     kickedOut,
43
     kickedOut,
43
     lockStateChanged,
44
     lockStateChanged,
44
     onStartMutedPolicyChanged,
45
     onStartMutedPolicyChanged,
111
     trackRemoved
112
     trackRemoved
112
 } from './react/features/base/tracks';
113
 } from './react/features/base/tracks';
113
 import { downloadJSON } from './react/features/base/util/downloadJSON';
114
 import { downloadJSON } from './react/features/base/util/downloadJSON';
114
-import { getConferenceOptions } from './react/features/conference/functions';
115
 import { showDesktopPicker } from './react/features/desktop-picker';
115
 import { showDesktopPicker } from './react/features/desktop-picker';
116
 import { appendSuffix } from './react/features/display-name';
116
 import { appendSuffix } from './react/features/display-name';
117
 import {
117
 import {
132
 import { toggleScreenshotCaptureEffect } from './react/features/screenshot-capture';
132
 import { toggleScreenshotCaptureEffect } from './react/features/screenshot-capture';
133
 import { AudioMixerEffect } from './react/features/stream-effects/audio-mixer/AudioMixerEffect';
133
 import { AudioMixerEffect } from './react/features/stream-effects/audio-mixer/AudioMixerEffect';
134
 import { createPresenterEffect } from './react/features/stream-effects/presenter';
134
 import { createPresenterEffect } from './react/features/stream-effects/presenter';
135
+import { createRnnoiseProcessor } from './react/features/stream-effects/rnnoise';
135
 import { endpointMessageReceived } from './react/features/subtitles';
136
 import { endpointMessageReceived } from './react/features/subtitles';
136
 import UIEvents from './service/UI/UIEvents';
137
 import UIEvents from './service/UI/UIEvents';
137
 
138
 
1357
     },
1358
     },
1358
 
1359
 
1359
     _getConferenceOptions() {
1360
     _getConferenceOptions() {
1360
-        return getConferenceOptions(APP.store.getState());
1361
+        const options = getConferenceOptions(APP.store.getState());
1362
+
1363
+        options.createVADProcessor = createRnnoiseProcessor;
1364
+
1365
+        return options;
1361
     },
1366
     },
1362
 
1367
 
1363
     /**
1368
     /**

+ 3
- 23
react/features/base/conference/actions.js 查看文件

6
     createStartMutedConfigurationEvent,
6
     createStartMutedConfigurationEvent,
7
     sendAnalytics
7
     sendAnalytics
8
 } from '../../analytics';
8
 } from '../../analytics';
9
-import { getName } from '../../app/functions';
10
 import { endpointMessageReceived } from '../../subtitles';
9
 import { endpointMessageReceived } from '../../subtitles';
11
 import { getReplaceParticipant } from '../config/functions';
10
 import { getReplaceParticipant } from '../config/functions';
12
 import { JITSI_CONNECTION_CONFERENCE_KEY } from '../connection';
11
 import { JITSI_CONNECTION_CONFERENCE_KEY } from '../connection';
14
 import { MEDIA_TYPE, setAudioMuted, setVideoMuted } from '../media';
13
 import { MEDIA_TYPE, setAudioMuted, setVideoMuted } from '../media';
15
 import {
14
 import {
16
     dominantSpeakerChanged,
15
     dominantSpeakerChanged,
17
-    getLocalParticipant,
18
     getNormalizedDisplayName,
16
     getNormalizedDisplayName,
19
     participantConnectionStatusChanged,
17
     participantConnectionStatusChanged,
20
     participantKicked,
18
     participantKicked,
24
     participantUpdated
22
     participantUpdated
25
 } from '../participants';
23
 } from '../participants';
26
 import { getLocalTracks, replaceLocalTrack, trackAdded, trackRemoved } from '../tracks';
24
 import { getLocalTracks, replaceLocalTrack, trackAdded, trackRemoved } from '../tracks';
27
-import {
28
-    getBackendSafePath,
29
-    getBackendSafeRoomName,
30
-    getJitsiMeetGlobalNS
31
-} from '../util';
25
+import { getBackendSafeRoomName } from '../util';
32
 
26
 
33
 import {
27
 import {
34
     AUTH_STATUS_CHANGED,
28
     AUTH_STATUS_CHANGED,
61
     _addLocalTracksToConference,
55
     _addLocalTracksToConference,
62
     commonUserJoinedHandling,
56
     commonUserJoinedHandling,
63
     commonUserLeftHandling,
57
     commonUserLeftHandling,
58
+    getConferenceOptions,
64
     getCurrentConference,
59
     getCurrentConference,
65
     sendLocalParticipant
60
     sendLocalParticipant
66
 } from './functions';
61
 } from './functions';
434
             throw new Error('Cannot join a conference without a room name!');
429
             throw new Error('Cannot join a conference without a room name!');
435
         }
430
         }
436
 
431
 
437
-        const config = state['features/base/config'];
438
-        const { tenant } = state['features/base/jwt'];
439
-        const { email, name: nick } = getLocalParticipant(state);
440
-
441
-        const conference
442
-            = connection.initJitsiConference(
443
-
444
-                getBackendSafeRoomName(room), {
445
-                    ...config,
446
-                    applicationName: getName(),
447
-                    getWiFiStatsMethod: getJitsiMeetGlobalNS().getWiFiStats,
448
-                    confID: `${locationURL.host}${getBackendSafePath(locationURL.pathname)}`,
449
-                    siteID: tenant,
450
-                    statisticsDisplayName: config.enableDisplayNameInStats ? nick : undefined,
451
-                    statisticsId: config.enableEmailInStats ? email : undefined
452
-                });
432
+        const conference = connection.initJitsiConference(getBackendSafeRoomName(room), getConferenceOptions(state));
453
 
433
 
454
         connection[JITSI_CONNECTION_CONFERENCE_KEY] = conference;
434
         connection[JITSI_CONNECTION_CONFERENCE_KEY] = conference;
455
 
435
 

+ 64
- 1
react/features/base/conference/functions.js 查看文件

2
 
2
 
3
 import _ from 'lodash';
3
 import _ from 'lodash';
4
 
4
 
5
+import { getName } from '../../app/functions';
5
 import { JitsiTrackErrors } from '../lib-jitsi-meet';
6
 import { JitsiTrackErrors } from '../lib-jitsi-meet';
6
 import {
7
 import {
7
     getLocalParticipant,
8
     getLocalParticipant,
11
     participantLeft
12
     participantLeft
12
 } from '../participants';
13
 } from '../participants';
13
 import { toState } from '../redux';
14
 import { toState } from '../redux';
14
-import { safeDecodeURIComponent } from '../util';
15
+import { getBackendSafePath, getJitsiMeetGlobalNS, safeDecodeURIComponent } from '../util';
15
 
16
 
16
 import {
17
 import {
17
     AVATAR_URL_COMMAND,
18
     AVATAR_URL_COMMAND,
198
     return safeStartCase(safeDecodeURIComponent(getConferenceState(toState(stateful)).room));
199
     return safeStartCase(safeDecodeURIComponent(getConferenceState(toState(stateful)).room));
199
 }
200
 }
200
 
201
 
202
+/**
203
+ * Returns an object aggregating the conference options.
204
+ *
205
+ * @param {Object|Function} stateful - The redux store state.
206
+ * @returns {Object} - Options object.
207
+ */
208
+export function getConferenceOptions(stateful: Function | Object) {
209
+    const state = toState(stateful);
210
+
211
+    const config = state['features/base/config'];
212
+    const { locationURL } = state['features/base/connection'];
213
+    const { tenant } = state['features/base/jwt'];
214
+    const { email, name: nick } = getLocalParticipant(state);
215
+    const options = { ...config };
216
+
217
+    if (tenant) {
218
+        options.siteID = tenant;
219
+    }
220
+
221
+    if (options.enableDisplayNameInStats && nick) {
222
+        options.statisticsDisplayName = nick;
223
+    }
224
+
225
+    if (options.enableEmailInStats && email) {
226
+        options.statisticsId = email;
227
+    }
228
+
229
+    if (locationURL) {
230
+        options.confID = `${locationURL.host}${getBackendSafePath(locationURL.pathname)}`;
231
+    }
232
+
233
+    options.applicationName = getName();
234
+
235
+    // Disable analytics, if requessted.
236
+    if (options.disableThirdPartyRequests) {
237
+        delete config.analytics.scriptURLs;
238
+        delete config.analytics.amplitudeAPPKey;
239
+        delete config.analytics.googleAnalyticsTrackingId;
240
+        delete options.callStatsID;
241
+        delete options.callStatsSecret;
242
+    } else {
243
+        options.getWiFiStatsMethod = getWiFiStatsMethod;
244
+    }
245
+
246
+    return options;
247
+}
248
+
201
 /**
249
 /**
202
 * Returns the UTC timestamp when the first participant joined the conference.
250
 * Returns the UTC timestamp when the first participant joined the conference.
203
 *
251
 *
244
     return getConferenceState(state).room;
292
     return getConferenceState(state).room;
245
 }
293
 }
246
 
294
 
295
+/**
296
+ * Returns the result of getWiFiStats from the global NS or does nothing
297
+ * (returns empty result).
298
+ * Fixes a concurrency problem where we need to pass a function when creating
299
+ * a JitsiConference, but that method is added to the context later.
300
+ *
301
+ * @returns {Promise}
302
+ * @private
303
+ */
304
+function getWiFiStatsMethod() {
305
+    const gloabalNS = getJitsiMeetGlobalNS();
306
+
307
+    return gloabalNS.getWiFiStats ? gloabalNS.getWiFiStats() : Promise.resolve('{}');
308
+}
309
+
247
 /**
310
 /**
248
  * Handle an error thrown by the backend (i.e. {@code lib-jitsi-meet}) while
311
  * Handle an error thrown by the backend (i.e. {@code lib-jitsi-meet}) while
249
  * manipulating a conference participant (e.g. Pin or select participant).
312
  * manipulating a conference participant (e.g. Pin or select participant).

+ 0
- 65
react/features/conference/functions.web.js 查看文件

1
-import { getName } from '../app/functions.web';
2
 import { isSuboptimalBrowser } from '../base/environment';
1
 import { isSuboptimalBrowser } from '../base/environment';
3
 import { translateToHTML } from '../base/i18n';
2
 import { translateToHTML } from '../base/i18n';
4
-import { getLocalParticipant } from '../base/participants';
5
-import { toState } from '../base/redux';
6
-import { getBackendSafePath, getJitsiMeetGlobalNS } from '../base/util';
7
 import { showWarningNotification } from '../notifications';
3
 import { showWarningNotification } from '../notifications';
8
-import { createRnnoiseProcessor } from '../stream-effects/rnnoise';
9
 
4
 
10
 export * from './functions.any';
5
 export * from './functions.any';
11
 
6
 
12
-/**
13
- * Returns the result of getWiFiStats from the global NS or does nothing
14
-(returns empty result).
15
- * Fixes a concurrency problem where we need to pass a function when creating
16
- * a JitsiConference, but that method is added to the context later.
17
- *
18
- * @returns {Promise}
19
- * @private
20
- */
21
-const getWiFiStatsMethod = () => {
22
-    const gloabalNS = getJitsiMeetGlobalNS();
23
-
24
-    return gloabalNS.getWiFiStats ? gloabalNS.getWiFiStats() : Promise.resolve('{}');
25
-};
26
-
27
 /**
7
 /**
28
  * Shows the suboptimal experience notification if needed.
8
  * Shows the suboptimal experience notification if needed.
29
  *
9
  *
49
         );
29
         );
50
     }
30
     }
51
 }
31
 }
52
-
53
-/**
54
- * Returns an object aggregating the conference options.
55
- *
56
- * @param {Object|Function} stateful - The redux store state.
57
- * @returns {Object} - Options object.
58
- */
59
-export function getConferenceOptions(stateful) {
60
-    const state = toState(stateful);
61
-
62
-    const options = state['features/base/config'];
63
-    const { locationURL } = state['features/base/connection'];
64
-    const { tenant } = state['features/base/jwt'];
65
-
66
-    const { email, name: nick } = getLocalParticipant(state);
67
-
68
-    if (tenant) {
69
-        options.siteID = tenant;
70
-    }
71
-
72
-    if (options.enableDisplayNameInStats && nick) {
73
-        options.statisticsDisplayName = nick;
74
-    }
75
-
76
-    if (options.enableEmailInStats && email) {
77
-        options.statisticsId = email;
78
-    }
79
-
80
-    if (locationURL) {
81
-        options.confID = `${locationURL.host}${getBackendSafePath(locationURL.pathname)}`;
82
-    }
83
-
84
-    options.applicationName = getName();
85
-    options.getWiFiStatsMethod = getWiFiStatsMethod;
86
-    options.createVADProcessor = createRnnoiseProcessor;
87
-
88
-    // Disable CallStats, if requessted.
89
-    if (options.disableThirdPartyRequests) {
90
-        delete options.callStatsID;
91
-        delete options.callStatsSecret;
92
-        delete options.getWiFiStatsMethod;
93
-    }
94
-
95
-    return options;
96
-}

+ 1
- 1
react/features/prejoin/components/PrejoinApp.js 查看文件

5
 import { batch } from 'react-redux';
5
 import { batch } from 'react-redux';
6
 
6
 
7
 import { BaseApp } from '../../../features/base/app';
7
 import { BaseApp } from '../../../features/base/app';
8
+import { getConferenceOptions } from '../../base/conference/functions';
8
 import { setConfig } from '../../base/config';
9
 import { setConfig } from '../../base/config';
9
 import { DialogContainer } from '../../base/dialog';
10
 import { DialogContainer } from '../../base/dialog';
10
 import { createPrejoinTracks } from '../../base/tracks';
11
 import { createPrejoinTracks } from '../../base/tracks';
11
-import { getConferenceOptions } from '../../conference/functions';
12
 import { initPrejoin, makePrecallTest } from '../actions';
12
 import { initPrejoin, makePrecallTest } from '../actions';
13
 
13
 
14
 import Prejoin from './Prejoin';
14
 import Prejoin from './Prejoin';

Loading…
取消
儲存