|
@@ -95,6 +95,8 @@ import {
|
95
|
95
|
createLocalPresenterTrack,
|
96
|
96
|
createLocalTracksF,
|
97
|
97
|
destroyLocalTracks,
|
|
98
|
+ getLocalJitsiAudioTrack,
|
|
99
|
+ getLocalJitsiVideoTrack,
|
98
|
100
|
isLocalVideoTrackMuted,
|
99
|
101
|
isLocalTrackMuted,
|
100
|
102
|
isUserInteractionRequiredForUnmute,
|
|
@@ -118,7 +120,8 @@ import { mediaPermissionPromptVisibilityChanged } from './react/features/overlay
|
118
|
120
|
import { suspendDetected } from './react/features/power-monitor';
|
119
|
121
|
import {
|
120
|
122
|
initPrejoin,
|
121
|
|
- isPrejoinPageEnabled
|
|
123
|
+ isPrejoinPageEnabled,
|
|
124
|
+ isPrejoinPageVisible
|
122
|
125
|
} from './react/features/prejoin';
|
123
|
126
|
import { createRnnoiseProcessorPromise } from './react/features/rnnoise';
|
124
|
127
|
import { toggleScreenshotCaptureEffect } from './react/features/screenshot-capture';
|
|
@@ -1400,19 +1403,32 @@ export default {
|
1400
|
1403
|
/**
|
1401
|
1404
|
* Start using provided video stream.
|
1402
|
1405
|
* Stops previous video stream.
|
1403
|
|
- * @param {JitsiLocalTrack} [stream] new stream to use or null
|
|
1406
|
+ * @param {JitsiLocalTrack} newTrack - new track to use or null
|
1404
|
1407
|
* @returns {Promise}
|
1405
|
1408
|
*/
|
1406
|
|
- useVideoStream(newStream) {
|
|
1409
|
+ useVideoStream(newTrack) {
|
1407
|
1410
|
return new Promise((resolve, reject) => {
|
1408
|
1411
|
_replaceLocalVideoTrackQueue.enqueue(onFinish => {
|
|
1412
|
+ const state = APP.store.getState();
|
|
1413
|
+
|
|
1414
|
+ // When the prejoin page is displayed localVideo is not set
|
|
1415
|
+ // so just replace the video track from the store with the new one.
|
|
1416
|
+ if (isPrejoinPageVisible(state)) {
|
|
1417
|
+ const oldTrack = getLocalJitsiVideoTrack(state);
|
|
1418
|
+
|
|
1419
|
+ return APP.store.dispatch(replaceLocalTrack(oldTrack, newTrack))
|
|
1420
|
+ .then(resolve)
|
|
1421
|
+ .catch(reject)
|
|
1422
|
+ .then(onFinish);
|
|
1423
|
+ }
|
|
1424
|
+
|
1409
|
1425
|
APP.store.dispatch(
|
1410
|
|
- replaceLocalTrack(this.localVideo, newStream, room))
|
|
1426
|
+ replaceLocalTrack(this.localVideo, newTrack, room))
|
1411
|
1427
|
.then(() => {
|
1412
|
|
- this.localVideo = newStream;
|
1413
|
|
- this._setSharingScreen(newStream);
|
1414
|
|
- if (newStream) {
|
1415
|
|
- APP.UI.addLocalVideoStream(newStream);
|
|
1428
|
+ this.localVideo = newTrack;
|
|
1429
|
+ this._setSharingScreen(newTrack);
|
|
1430
|
+ if (newTrack) {
|
|
1431
|
+ APP.UI.addLocalVideoStream(newTrack);
|
1416
|
1432
|
}
|
1417
|
1433
|
this.setVideoMuteStatus(this.isLocalVideoMuted());
|
1418
|
1434
|
})
|
|
@@ -1453,16 +1469,29 @@ export default {
|
1453
|
1469
|
/**
|
1454
|
1470
|
* Start using provided audio stream.
|
1455
|
1471
|
* Stops previous audio stream.
|
1456
|
|
- * @param {JitsiLocalTrack} [stream] new stream to use or null
|
|
1472
|
+ * @param {JitsiLocalTrack} newTrack - new track to use or null
|
1457
|
1473
|
* @returns {Promise}
|
1458
|
1474
|
*/
|
1459
|
|
- useAudioStream(newStream) {
|
|
1475
|
+ useAudioStream(newTrack) {
|
1460
|
1476
|
return new Promise((resolve, reject) => {
|
1461
|
1477
|
_replaceLocalAudioTrackQueue.enqueue(onFinish => {
|
|
1478
|
+ const state = APP.store.getState();
|
|
1479
|
+
|
|
1480
|
+ // When the prejoin page is displayed localAudio is not set
|
|
1481
|
+ // so just replace the audio track from the store with the new one.
|
|
1482
|
+ if (isPrejoinPageVisible(state)) {
|
|
1483
|
+ const oldTrack = getLocalJitsiAudioTrack(state);
|
|
1484
|
+
|
|
1485
|
+ return APP.store.dispatch(replaceLocalTrack(oldTrack, newTrack))
|
|
1486
|
+ .then(resolve)
|
|
1487
|
+ .catch(reject)
|
|
1488
|
+ .then(onFinish);
|
|
1489
|
+ }
|
|
1490
|
+
|
1462
|
1491
|
APP.store.dispatch(
|
1463
|
|
- replaceLocalTrack(this.localAudio, newStream, room))
|
|
1492
|
+ replaceLocalTrack(this.localAudio, newTrack, room))
|
1464
|
1493
|
.then(() => {
|
1465
|
|
- this.localAudio = newStream;
|
|
1494
|
+ this.localAudio = newTrack;
|
1466
|
1495
|
this.setAudioMuteStatus(this.isLocalAudioMuted());
|
1467
|
1496
|
})
|
1468
|
1497
|
.then(resolve)
|