|
@@ -10,7 +10,7 @@ import { getName } from '../../app/functions';
|
10
|
10
|
import { endpointMessageReceived } from '../../subtitles';
|
11
|
11
|
import { JITSI_CONNECTION_CONFERENCE_KEY } from '../connection';
|
12
|
12
|
import { JitsiConferenceEvents } from '../lib-jitsi-meet';
|
13
|
|
-import { setAudioMuted, setVideoMuted } from '../media';
|
|
13
|
+import { MEDIA_TYPE, setAudioMuted, setVideoMuted } from '../media';
|
14
|
14
|
import {
|
15
|
15
|
dominantSpeakerChanged,
|
16
|
16
|
getLocalParticipant,
|
|
@@ -22,7 +22,7 @@ import {
|
22
|
22
|
participantRoleChanged,
|
23
|
23
|
participantUpdated
|
24
|
24
|
} from '../participants';
|
25
|
|
-import { getLocalTracks, trackAdded, trackRemoved } from '../tracks';
|
|
25
|
+import { getLocalTracks, replaceLocalTrack, trackAdded, trackRemoved } from '../tracks';
|
26
|
26
|
import {
|
27
|
27
|
getBackendSafePath,
|
28
|
28
|
getBackendSafeRoomName,
|
|
@@ -72,10 +72,11 @@ declare var APP: Object;
|
72
|
72
|
*
|
73
|
73
|
* @param {JitsiConference} conference - The JitsiConference instance.
|
74
|
74
|
* @param {Dispatch} dispatch - The Redux dispatch function.
|
|
75
|
+ * @param {Object} state - The Redux state.
|
75
|
76
|
* @private
|
76
|
77
|
* @returns {void}
|
77
|
78
|
*/
|
78
|
|
-function _addConferenceListeners(conference, dispatch) {
|
|
79
|
+function _addConferenceListeners(conference, dispatch, state) {
|
79
|
80
|
// A simple logger for conference errors received through
|
80
|
81
|
// the listener. These errors are not handled now, but logged.
|
81
|
82
|
conference.on(JitsiConferenceEvents.CONFERENCE_ERROR,
|
|
@@ -118,13 +119,12 @@ function _addConferenceListeners(conference, dispatch) {
|
118
|
119
|
conference.on(
|
119
|
120
|
JitsiConferenceEvents.STARTED_MUTED,
|
120
|
121
|
() => {
|
121
|
|
- const audioMuted = Boolean(conference.startAudioMuted);
|
122
|
|
- const videoMuted = Boolean(conference.startVideoMuted);
|
|
122
|
+ const audioMuted = Boolean(conference.isStartAudioMuted());
|
|
123
|
+ const videoMuted = Boolean(conference.isStartVideoMuted());
|
|
124
|
+ const localTracks = getLocalTracks(state['features/base/tracks']);
|
123
|
125
|
|
124
|
|
- sendAnalytics(createStartMutedConfigurationEvent(
|
125
|
|
- 'remote', audioMuted, videoMuted));
|
126
|
|
- logger.log(`Start muted: ${audioMuted ? 'audio, ' : ''}${
|
127
|
|
- videoMuted ? 'video' : ''}`);
|
|
126
|
+ sendAnalytics(createStartMutedConfigurationEvent('remote', audioMuted, videoMuted));
|
|
127
|
+ logger.log(`Start muted: ${audioMuted ? 'audio, ' : ''}${videoMuted ? 'video' : ''}`);
|
128
|
128
|
|
129
|
129
|
// XXX Jicofo tells lib-jitsi-meet to start with audio and/or video
|
130
|
130
|
// muted i.e. Jicofo expresses an intent. Lib-jitsi-meet has turned
|
|
@@ -136,6 +136,14 @@ function _addConferenceListeners(conference, dispatch) {
|
136
|
136
|
// acting on Jicofo's intent without the app's knowledge.
|
137
|
137
|
dispatch(setAudioMuted(audioMuted));
|
138
|
138
|
dispatch(setVideoMuted(videoMuted));
|
|
139
|
+
|
|
140
|
+ // Remove the tracks from peerconnection as well.
|
|
141
|
+ for (const track of localTracks) {
|
|
142
|
+ if ((audioMuted && track.jitsiTrack.getType() === MEDIA_TYPE.AUDIO)
|
|
143
|
+ || (videoMuted && track.jitsiTrack.getType() === MEDIA_TYPE.VIDEO)) {
|
|
144
|
+ replaceLocalTrack(track.jitsiTrack, null, conference);
|
|
145
|
+ }
|
|
146
|
+ }
|
139
|
147
|
});
|
140
|
148
|
|
141
|
149
|
// Dispatches into features/base/tracks follow:
|
|
@@ -448,7 +456,7 @@ export function createConference() {
|
448
|
456
|
|
449
|
457
|
dispatch(_conferenceWillJoin(conference));
|
450
|
458
|
|
451
|
|
- _addConferenceListeners(conference, dispatch);
|
|
459
|
+ _addConferenceListeners(conference, dispatch, state);
|
452
|
460
|
|
453
|
461
|
sendLocalParticipant(state, conference);
|
454
|
462
|
|