Browse Source

fix(load-test): Create local tracks and then join.

Behaves now as the main client, and skips few unnecessary presences.
master
damencho 4 years ago
parent
commit
04ee423257
1 changed files with 22 additions and 22 deletions
  1. 22
    22
      resources/load-test/load-test-participant.js

+ 22
- 22
resources/load-test/load-test-participant.js View File

147
  */
147
  */
148
 function onConferenceJoined() {
148
 function onConferenceJoined() {
149
     isJoined = true;
149
     isJoined = true;
150
-    for (let i = 0; i < localTracks.length; i++) {
151
-        room.addTrack(localTracks[i]);
152
-    }
153
 }
150
 }
154
 
151
 
155
 /**
152
 /**
187
         remoteTracks[id] = [];
184
         remoteTracks[id] = [];
188
     });
185
     });
189
     room.on(JitsiMeetJS.events.conference.USER_LEFT, onUserLeft);
186
     room.on(JitsiMeetJS.events.conference.USER_LEFT, onUserLeft);
190
-    room.join();
187
+
188
+    const devices = [];
189
+
190
+    if (localVideo) {
191
+        devices.push('video');
192
+    }
193
+    if (localAudio) {
194
+        devices.push('audio');
195
+    }
196
+    if (devices.length > 0) {
197
+        JitsiMeetJS.createLocalTracks({ devices })
198
+            .then(onLocalTracks)
199
+            .then(() => {
200
+                room.join();
201
+            })
202
+            .catch(error => {
203
+                throw error;
204
+            });
205
+    } else {
206
+        room.join();
207
+    }
208
+
191
     updateMaxFrameHeight();
209
     updateMaxFrameHeight();
192
 }
210
 }
193
 
211
 
239
 connection.addEventListener(JitsiMeetJS.events.connection.CONNECTION_FAILED, onConnectionFailed);
257
 connection.addEventListener(JitsiMeetJS.events.connection.CONNECTION_FAILED, onConnectionFailed);
240
 connection.addEventListener(JitsiMeetJS.events.connection.CONNECTION_DISCONNECTED, disconnect);
258
 connection.addEventListener(JitsiMeetJS.events.connection.CONNECTION_DISCONNECTED, disconnect);
241
 connection.connect();
259
 connection.connect();
242
-
243
-const devices = [];
244
-
245
-if (localVideo) {
246
-    devices.push('video');
247
-}
248
-if (localAudio) {
249
-    devices.push('audio');
250
-}
251
-if (devices.length > 0) {
252
-    JitsiMeetJS.createLocalTracks({ devices })
253
-    .then(onLocalTracks)
254
-    .catch(error => {
255
-        throw error;
256
-    });
257
-}
258
-
259
-

Loading…
Cancel
Save