|
@@ -42,7 +42,11 @@ import {
|
42
|
42
|
participantRoleChanged,
|
43
|
43
|
participantUpdated
|
44
|
44
|
} from './react/features/base/participants';
|
45
|
|
-import { trackAdded, trackRemoved } from './react/features/base/tracks';
|
|
45
|
+import {
|
|
46
|
+ replaceLocalTrack,
|
|
47
|
+ trackAdded,
|
|
48
|
+ trackRemoved
|
|
49
|
+} from './react/features/base/tracks';
|
46
|
50
|
import {
|
47
|
51
|
showDesktopPicker
|
48
|
52
|
} from './react/features/desktop-picker';
|
|
@@ -1023,16 +1027,9 @@ export default {
|
1023
|
1027
|
* @returns {Promise}
|
1024
|
1028
|
*/
|
1025
|
1029
|
useVideoStream(newStream) {
|
1026
|
|
- return room.replaceTrack(localVideo, newStream)
|
|
1030
|
+ return APP.store.dispatch(
|
|
1031
|
+ replaceLocalTrack(localVideo, newStream, room))
|
1027
|
1032
|
.then(() => {
|
1028
|
|
- // We call dispose after doing the replace because
|
1029
|
|
- // dispose will try and do a new o/a after the
|
1030
|
|
- // track removes itself. Doing it after means
|
1031
|
|
- // the JitsiLocalTrack::conference member is already
|
1032
|
|
- // cleared, so it won't try and do the o/a
|
1033
|
|
- if (localVideo) {
|
1034
|
|
- localVideo.dispose();
|
1035
|
|
- }
|
1036
|
1033
|
localVideo = newStream;
|
1037
|
1034
|
if (newStream) {
|
1038
|
1035
|
this.videoMuted = newStream.isMuted();
|
|
@@ -1058,16 +1055,9 @@ export default {
|
1058
|
1055
|
* @returns {Promise}
|
1059
|
1056
|
*/
|
1060
|
1057
|
useAudioStream(newStream) {
|
1061
|
|
- return room.replaceTrack(localAudio, newStream)
|
|
1058
|
+ return APP.store.dispatch(
|
|
1059
|
+ replaceLocalTrack(localAudio, newStream, room))
|
1062
|
1060
|
.then(() => {
|
1063
|
|
- // We call dispose after doing the replace because
|
1064
|
|
- // dispose will try and do a new o/a after the
|
1065
|
|
- // track removes itself. Doing it after means
|
1066
|
|
- // the JitsiLocalTrack::conference member is already
|
1067
|
|
- // cleared, so it won't try and do the o/a
|
1068
|
|
- if (localAudio) {
|
1069
|
|
- localAudio.dispose();
|
1070
|
|
- }
|
1071
|
1061
|
localAudio = newStream;
|
1072
|
1062
|
if (newStream) {
|
1073
|
1063
|
this.audioMuted = newStream.isMuted();
|
|
@@ -1338,24 +1328,6 @@ export default {
|
1338
|
1328
|
APP.store.dispatch(trackRemoved(track));
|
1339
|
1329
|
});
|
1340
|
1330
|
|
1341
|
|
- room.on(ConferenceEvents.TRACK_MUTE_CHANGED, (track) => {
|
1342
|
|
- if (!track || !track.isLocal()) {
|
1343
|
|
- return;
|
1344
|
|
- }
|
1345
|
|
-
|
1346
|
|
- const handler = (track.getType() === "audio")?
|
1347
|
|
- APP.UI.setAudioMuted : APP.UI.setVideoMuted;
|
1348
|
|
- const mute = track.isMuted();
|
1349
|
|
- const id = APP.conference.getMyUserId();
|
1350
|
|
-
|
1351
|
|
- if (track.getType() === "audio") {
|
1352
|
|
- this.audioMuted = mute;
|
1353
|
|
- } else {
|
1354
|
|
- this.videoMuted = mute;
|
1355
|
|
- }
|
1356
|
|
-
|
1357
|
|
- handler(id , mute);
|
1358
|
|
- });
|
1359
|
1331
|
room.on(ConferenceEvents.TRACK_AUDIO_LEVEL_CHANGED, (id, lvl) => {
|
1360
|
1332
|
if(this.isLocalId(id) && localAudio && localAudio.isMuted()) {
|
1361
|
1333
|
lvl = 0;
|