|
@@ -1,27 +1,30 @@
|
1
|
1
|
// @flow
|
2
|
2
|
|
3
|
3
|
declare var JitsiMeetJS: Object;
|
|
4
|
+declare var APP: Object;
|
4
|
5
|
|
5
|
6
|
import uuid from 'uuid';
|
6
|
7
|
|
7
|
|
-import { getDialOutStatusUrl, getDialOutUrl } from '../base/config/functions';
|
|
8
|
+import { getDialOutStatusUrl, getDialOutUrl, updateConfig } from '../base/config';
|
|
9
|
+import { isIosMobileBrowser } from '../base/environment/utils';
|
8
|
10
|
import { createLocalTrack } from '../base/lib-jitsi-meet';
|
9
|
|
-import { isVideoMutedByUser } from '../base/media';
|
|
11
|
+import { isVideoMutedByUser, MEDIA_TYPE } from '../base/media';
|
|
12
|
+import { updateSettings } from '../base/settings';
|
10
|
13
|
import {
|
|
14
|
+ createLocalTracksF,
|
11
|
15
|
getLocalAudioTrack,
|
|
16
|
+ getLocalTracks,
|
12
|
17
|
getLocalVideoTrack,
|
13
|
18
|
trackAdded,
|
14
|
19
|
replaceLocalTrack
|
15
|
20
|
} from '../base/tracks';
|
16
|
|
-import { createLocalTracksF } from '../base/tracks/functions';
|
17
|
21
|
import { openURLInBrowser } from '../base/util';
|
18
|
22
|
import { executeDialOutRequest, executeDialOutStatusRequest, getDialInfoPageURL } from '../invite/functions';
|
19
|
23
|
import { showErrorNotification } from '../notifications';
|
20
|
24
|
|
21
|
25
|
import {
|
|
26
|
+ PREJOIN_JOINING_IN_PROGRESS,
|
22
|
27
|
PREJOIN_INITIALIZED,
|
23
|
|
- PREJOIN_START_CONFERENCE,
|
24
|
|
- SET_DEVICE_STATUS,
|
25
|
28
|
SET_DIALOUT_COUNTRY,
|
26
|
29
|
SET_DIALOUT_NUMBER,
|
27
|
30
|
SET_DIALOUT_STATUS,
|
|
@@ -31,9 +34,10 @@ import {
|
31
|
34
|
SET_JOIN_BY_PHONE_DIALOG_VISIBLITY,
|
32
|
35
|
SET_PRECALL_TEST_RESULTS,
|
33
|
36
|
SET_PREJOIN_DEVICE_ERRORS,
|
34
|
|
- SET_PREJOIN_PAGE_VISIBILITY
|
|
37
|
+ SET_PREJOIN_PAGE_VISIBILITY,
|
|
38
|
+ SET_DEVICE_STATUS
|
35
|
39
|
} from './actionTypes';
|
36
|
|
-import { type PREJOIN_SCREEN_STATE } from './constants';
|
|
40
|
+import { type PREJOIN_SCREEN_STATE, PREJOIN_SCREEN_STATES } from './constants';
|
37
|
41
|
import {
|
38
|
42
|
getFullDialOutNumber,
|
39
|
43
|
getDialOutConferenceUrl,
|
|
@@ -209,15 +213,74 @@ export function initPrejoin(tracks: Object[], errors: Object) {
|
209
|
213
|
* Action used to start the conference.
|
210
|
214
|
*
|
211
|
215
|
* @param {Object} options - The config options that override the default ones (if any).
|
|
216
|
+ * @param {boolean} ignoreJoiningInProgress - If true we won't check the joiningInProgress flag.
|
212
|
217
|
* @returns {Function}
|
213
|
218
|
*/
|
214
|
|
-export function joinConference(options?: Object) {
|
|
219
|
+export function joinConference(options?: Object, ignoreJoiningInProgress: boolean = false) {
|
|
220
|
+ return async function(dispatch: Function, getState: Function) {
|
|
221
|
+ if (!ignoreJoiningInProgress) {
|
|
222
|
+ const state = getState();
|
|
223
|
+ const { joiningInProgress } = state['features/prejoin'];
|
|
224
|
+
|
|
225
|
+ if (joiningInProgress) {
|
|
226
|
+ return;
|
|
227
|
+ }
|
|
228
|
+
|
|
229
|
+ dispatch(setJoiningInProgress(true));
|
|
230
|
+ }
|
|
231
|
+
|
|
232
|
+ const state = getState();
|
|
233
|
+ const { userSelectedSkipPrejoin } = state['features/prejoin'];
|
|
234
|
+ let localTracks = getLocalTracks(state['features/base/tracks']);
|
|
235
|
+
|
|
236
|
+ options && dispatch(updateConfig(options));
|
|
237
|
+
|
|
238
|
+ userSelectedSkipPrejoin && dispatch(updateSettings({
|
|
239
|
+ userSelectedSkipPrejoin
|
|
240
|
+ }));
|
|
241
|
+
|
|
242
|
+ // Do not signal audio/video tracks if the user joins muted.
|
|
243
|
+ for (const track of localTracks) {
|
|
244
|
+ // Always add the audio track on mobile Safari because of a known issue where audio playout doesn't happen
|
|
245
|
+ // if the user joins audio and video muted.
|
|
246
|
+ if (track.muted
|
|
247
|
+ && !(isIosMobileBrowser() && track.jitsiTrack && track.jitsiTrack.getType() === MEDIA_TYPE.AUDIO)) {
|
|
248
|
+ try {
|
|
249
|
+ await dispatch(replaceLocalTrack(track.jitsiTrack, null));
|
|
250
|
+ } catch (error) {
|
|
251
|
+ logger.error(`Failed to replace local track (${track.jitsiTrack}) with null: ${error}`);
|
|
252
|
+ }
|
|
253
|
+ }
|
|
254
|
+ }
|
|
255
|
+
|
|
256
|
+ // Re-fetch the local tracks after muted tracks have been removed above.
|
|
257
|
+ // This is needed, because the tracks are effectively disposed by the replaceLocalTrack and should not be used
|
|
258
|
+ // anymore.
|
|
259
|
+ localTracks = getLocalTracks(getState()['features/base/tracks']);
|
|
260
|
+
|
|
261
|
+ const jitsiTracks = localTracks.map(t => t.jitsiTrack);
|
|
262
|
+
|
|
263
|
+ dispatch(setPrejoinPageVisibility(PREJOIN_SCREEN_STATES.LOADING));
|
|
264
|
+
|
|
265
|
+ APP.conference.prejoinStart(jitsiTracks);
|
|
266
|
+ };
|
|
267
|
+}
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+/**
|
|
271
|
+ * Action used to set the flag for joining operation in progress.
|
|
272
|
+ *
|
|
273
|
+ * @param {boolean} value - The config options that override the default ones (if any).
|
|
274
|
+ * @returns {Function}
|
|
275
|
+ */
|
|
276
|
+export function setJoiningInProgress(value: boolean) {
|
215
|
277
|
return {
|
216
|
|
- type: PREJOIN_START_CONFERENCE,
|
217
|
|
- options
|
|
278
|
+ type: PREJOIN_JOINING_IN_PROGRESS,
|
|
279
|
+ value
|
218
|
280
|
};
|
219
|
281
|
}
|
220
|
282
|
|
|
283
|
+
|
221
|
284
|
/**
|
222
|
285
|
* Joins the conference without audio.
|
223
|
286
|
*
|
|
@@ -225,16 +288,28 @@ export function joinConference(options?: Object) {
|
225
|
288
|
*/
|
226
|
289
|
export function joinConferenceWithoutAudio() {
|
227
|
290
|
return async function(dispatch: Function, getState: Function) {
|
228
|
|
- const tracks = getState()['features/base/tracks'];
|
|
291
|
+ const state = getState();
|
|
292
|
+ const { joiningInProgress } = state['features/prejoin'];
|
|
293
|
+
|
|
294
|
+ if (joiningInProgress) {
|
|
295
|
+ return;
|
|
296
|
+ }
|
|
297
|
+
|
|
298
|
+ dispatch(setJoiningInProgress(true));
|
|
299
|
+ const tracks = state['features/base/tracks'];
|
229
|
300
|
const audioTrack = getLocalAudioTrack(tracks)?.jitsiTrack;
|
230
|
301
|
|
231
|
302
|
if (audioTrack) {
|
232
|
|
- await dispatch(replaceLocalTrack(audioTrack, null));
|
|
303
|
+ try {
|
|
304
|
+ await dispatch(replaceLocalTrack(audioTrack, null));
|
|
305
|
+ } catch (error) {
|
|
306
|
+ logger.error(`Failed to replace local audio with null: ${error}`);
|
|
307
|
+ }
|
233
|
308
|
}
|
234
|
309
|
|
235
|
310
|
dispatch(joinConference({
|
236
|
311
|
startSilent: true
|
237
|
|
- }));
|
|
312
|
+ }, true));
|
238
|
313
|
};
|
239
|
314
|
}
|
240
|
315
|
|