|
@@ -13,7 +13,10 @@ const {
|
13
|
13
|
localVideo = config.startWithVideoMuted !== true,
|
14
|
14
|
remoteVideo = isHuman,
|
15
|
15
|
remoteAudio = isHuman,
|
16
|
|
- autoPlayVideo = config.testing.noAutoPlayVideo !== true
|
|
16
|
+ autoPlayVideo = config.testing.noAutoPlayVideo !== true,
|
|
17
|
+
|
|
18
|
+ // Whether to create local audio even if muted
|
|
19
|
+ autoCreateLocalAudio = config.testing.noAutoLocalAudio !== true
|
17
|
20
|
} = params;
|
18
|
21
|
|
19
|
22
|
const { room: roomName } = parseURIString(window.location.toString());
|
|
@@ -149,6 +152,27 @@ function onConferenceJoined() {
|
149
|
152
|
console.log('Conference joined');
|
150
|
153
|
}
|
151
|
154
|
|
|
155
|
+/**
|
|
156
|
+ * Handles start muted events, when audio and/or video are muted due to
|
|
157
|
+ * startAudioMuted or startVideoMuted policy.
|
|
158
|
+ */
|
|
159
|
+function onStartMuted() {
|
|
160
|
+ // Give it some time, as it may be currently in the process of muting
|
|
161
|
+ setTimeout(() => {
|
|
162
|
+ const localAudioTrack = room.getLocalAudioTrack();
|
|
163
|
+
|
|
164
|
+ if (localAudio && localAudioTrack && localAudioTrack.isMuted()) {
|
|
165
|
+ localAudioTrack.unmute();
|
|
166
|
+ }
|
|
167
|
+
|
|
168
|
+ const localVideoTrack = room.getLocalVideoTrack();
|
|
169
|
+
|
|
170
|
+ if (localVideo && localVideoTrack && localVideoTrack.isMuted()) {
|
|
171
|
+ localVideoTrack.unmute();
|
|
172
|
+ }
|
|
173
|
+ }, 2000);
|
|
174
|
+}
|
|
175
|
+
|
152
|
176
|
/**
|
153
|
177
|
*
|
154
|
178
|
* @param id
|
|
@@ -176,6 +200,7 @@ function onUserLeft(id) {
|
176
|
200
|
*/
|
177
|
201
|
function onConnectionSuccess() {
|
178
|
202
|
room = connection.initJitsiConference(roomName.toLowerCase(), config);
|
|
203
|
+ room.on(JitsiMeetJS.events.conference.STARTED_MUTED, onStartMuted);
|
179
|
204
|
room.on(JitsiMeetJS.events.conference.TRACK_ADDED, onRemoteTrack);
|
180
|
205
|
room.on(JitsiMeetJS.events.conference.CONFERENCE_JOINED, onConferenceJoined);
|
181
|
206
|
room.on(JitsiMeetJS.events.conference.USER_JOINED, id => {
|
|
@@ -190,7 +215,10 @@ function onConnectionSuccess() {
|
190
|
215
|
if (localVideo) {
|
191
|
216
|
devices.push('video');
|
192
|
217
|
}
|
193
|
|
- devices.push('audio');
|
|
218
|
+
|
|
219
|
+ if (autoCreateLocalAudio) {
|
|
220
|
+ devices.push('audio');
|
|
221
|
+ }
|
194
|
222
|
|
195
|
223
|
if (devices.length > 0) {
|
196
|
224
|
JitsiMeetJS.createLocalTracks({ devices })
|