fix(load-test): Always create local audio track. (#8612)

* fix(load-test): Always create local audio track.

When audio mutes will mute the track. Also fixes previous change where we do not add any of the tracks to the room.

* squash: Fix lint errors.
This commit is contained in:
Дамян Минков 2021-02-11 17:25:46 -06:00 committed by GitHub
parent fec2641730
commit 2cd43ba2e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 9 deletions

View File

@ -20,8 +20,6 @@ const { room: roomName } = parseURIString(window.location.toString());
let connection = null; let connection = null;
let isJoined = false;
let room = null; let room = null;
let numParticipants = 1; let numParticipants = 1;
@ -107,13 +105,15 @@ function onLocalTracks(tracks = []) {
$('body').append(`<video ${autoPlayVideo ? 'autoplay="1" ' : ''}id='localVideo${i}' />`); $('body').append(`<video ${autoPlayVideo ? 'autoplay="1" ' : ''}id='localVideo${i}' />`);
localTracks[i].attach($(`#localVideo${i}`)[0]); localTracks[i].attach($(`#localVideo${i}`)[0]);
} else { } else {
if (!localAudio) {
localTracks[i].mute();
}
$('body').append( $('body').append(
`<audio autoplay='1' muted='true' id='localAudio${i}' />`); `<audio autoplay='1' muted='true' id='localAudio${i}' />`);
localTracks[i].attach($(`#localAudio${i}`)[0]); localTracks[i].attach($(`#localAudio${i}`)[0]);
} }
if (isJoined) { room.addTrack(localTracks[i]);
room.addTrack(localTracks[i]);
}
} }
} }
@ -146,7 +146,7 @@ function onRemoteTrack(track) {
* That function is executed when the conference is joined * That function is executed when the conference is joined
*/ */
function onConferenceJoined() { function onConferenceJoined() {
isJoined = true; console.log('Conference joined');
} }
/** /**
@ -190,9 +190,8 @@ function onConnectionSuccess() {
if (localVideo) { if (localVideo) {
devices.push('video'); devices.push('video');
} }
if (localAudio) { devices.push('audio');
devices.push('audio');
}
if (devices.length > 0) { if (devices.length > 0) {
JitsiMeetJS.createLocalTracks({ devices }) JitsiMeetJS.createLocalTracks({ devices })
.then(onLocalTracks) .then(onLocalTracks)