瀏覽代碼

feat(load-test): Load test startmuted (#8629)

* feat(load-test): Senders unmute themselves if muted by policy.

* feat(load-test): Adds option to skip creating local audio track.

We currently create local audio track even when starting audio muted. Adding the option to control that can load test that for clients or signalling.
master
Дамян Минков 4 年之前
父節點
當前提交
8fcaea9e3d
No account linked to committer's email address
共有 1 個文件被更改,包括 30 次插入2 次删除
  1. 30
    2
      resources/load-test/load-test-participant.js

+ 30
- 2
resources/load-test/load-test-participant.js 查看文件

13
     localVideo = config.startWithVideoMuted !== true,
13
     localVideo = config.startWithVideoMuted !== true,
14
     remoteVideo = isHuman,
14
     remoteVideo = isHuman,
15
     remoteAudio = isHuman,
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
 } = params;
20
 } = params;
18
 
21
 
19
 const { room: roomName } = parseURIString(window.location.toString());
22
 const { room: roomName } = parseURIString(window.location.toString());
149
     console.log('Conference joined');
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
  * @param id
178
  * @param id
176
  */
200
  */
177
 function onConnectionSuccess() {
201
 function onConnectionSuccess() {
178
     room = connection.initJitsiConference(roomName.toLowerCase(), config);
202
     room = connection.initJitsiConference(roomName.toLowerCase(), config);
203
+    room.on(JitsiMeetJS.events.conference.STARTED_MUTED, onStartMuted);
179
     room.on(JitsiMeetJS.events.conference.TRACK_ADDED, onRemoteTrack);
204
     room.on(JitsiMeetJS.events.conference.TRACK_ADDED, onRemoteTrack);
180
     room.on(JitsiMeetJS.events.conference.CONFERENCE_JOINED, onConferenceJoined);
205
     room.on(JitsiMeetJS.events.conference.CONFERENCE_JOINED, onConferenceJoined);
181
     room.on(JitsiMeetJS.events.conference.USER_JOINED, id => {
206
     room.on(JitsiMeetJS.events.conference.USER_JOINED, id => {
190
     if (localVideo) {
215
     if (localVideo) {
191
         devices.push('video');
216
         devices.push('video');
192
     }
217
     }
193
-    devices.push('audio');
218
+
219
+    if (autoCreateLocalAudio) {
220
+        devices.push('audio');
221
+    }
194
 
222
 
195
     if (devices.length > 0) {
223
     if (devices.length > 0) {
196
         JitsiMeetJS.createLocalTracks({ devices })
224
         JitsiMeetJS.createLocalTracks({ devices })

Loading…
取消
儲存