Load test: emulate Jitsi-Meet's lastN and selectParticipant behavior. (#8926)
This commit is contained in:
parent
0ca47e9ffb
commit
357bbd1158
|
@ -3,6 +3,7 @@ import 'jquery';
|
|||
import { setConfigFromURLParams } from '../../react/features/base/config/functions';
|
||||
import { parseURLParams } from '../../react/features/base/util/parseURLParams';
|
||||
import { parseURIString } from '../../react/features/base/util/uri';
|
||||
import { validateLastNLimits, limitLastN } from '../../react/features/base/lastn/functions';
|
||||
|
||||
setConfigFromURLParams(config, {}, {}, window.location);
|
||||
|
||||
|
@ -107,12 +108,35 @@ function updateMaxFrameHeight() {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Simple emulation of jitsi-meet's lastN behavior
|
||||
*/
|
||||
function updateLastN() {
|
||||
let lastN = typeof config.channelLastN === 'undefined' ? -1 : config.channelLastN;
|
||||
|
||||
const limitedLastN = limitLastN(numParticipants, validateLastNLimits(config.lastNLimits));
|
||||
|
||||
if (limitedLastN !== undefined) {
|
||||
lastN = lastN === -1 ? limitedLastN : Math.min(limitedLastN, lastN);
|
||||
}
|
||||
|
||||
if (lastN === room.getLastN()) {
|
||||
return;
|
||||
}
|
||||
|
||||
room.setLastN(lastN);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
function setNumberOfParticipants() {
|
||||
$('#participants').text(numParticipants);
|
||||
/* jitsi-meet's current Tile View behavior. */
|
||||
const ids = room.getParticipants().map(participant => participant.id);
|
||||
room.selectParticipants(ids);
|
||||
updateMaxFrameHeight();
|
||||
updateLastN();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -194,6 +218,16 @@ function onStartMuted() {
|
|||
}, 2000);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
function onUserJoined(id) {
|
||||
numParticipants++;
|
||||
setNumberOfParticipants();
|
||||
remoteTracks[id] = [];
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param id
|
||||
|
@ -224,11 +258,7 @@ function onConnectionSuccess() {
|
|||
room.on(JitsiMeetJS.events.conference.STARTED_MUTED, onStartMuted);
|
||||
room.on(JitsiMeetJS.events.conference.TRACK_ADDED, onRemoteTrack);
|
||||
room.on(JitsiMeetJS.events.conference.CONFERENCE_JOINED, onConferenceJoined);
|
||||
room.on(JitsiMeetJS.events.conference.USER_JOINED, id => {
|
||||
numParticipants++;
|
||||
setNumberOfParticipants();
|
||||
remoteTracks[id] = [];
|
||||
});
|
||||
room.on(JitsiMeetJS.events.conference.USER_JOINED, onUserJoined);
|
||||
room.on(JitsiMeetJS.events.conference.USER_LEFT, onUserLeft);
|
||||
|
||||
const devices = [];
|
||||
|
|
Loading…
Reference in New Issue