/* global $, config, JitsiMeetJS */ 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'; setConfigFromURLParams(config, {}, {}, window.location); const params = parseURLParams(window.location, false, 'hash'); const { isHuman = false } = params; const { localAudio = config.startWithAudioMuted !== true, localVideo = config.startWithVideoMuted !== true, remoteVideo = isHuman, remoteAudio = isHuman, autoPlayVideo = config.testing.noAutoPlayVideo !== true } = params; const { room: roomName } = parseURIString(window.location.toString()); let connection = null; let isJoined = false; let room = null; let numParticipants = 1; let localTracks = []; const remoteTracks = {}; let maxFrameHeight = 0; window.APP = { conference: { getStats() { return room.connectionQuality.getStats(); }, getConnectionState() { return room && room.getConnectionState(); } }, get room() { return room; }, get connection() { return connection; }, get numParticipants() { return numParticipants; }, get localTracks() { return localTracks; }, get remoteTracks() { return remoteTracks; }, get params() { return { roomName, localAudio, localVideo, remoteVideo, remoteAudio, autoPlayVideo }; } }; /** * Simple emulation of jitsi-meet's screen layout behavior */ function updateMaxFrameHeight() { let newMaxFrameHeight; if (numParticipants <= 2) { newMaxFrameHeight = 720; } else if (numParticipants <= 4) { newMaxFrameHeight = 360; } else { newMaxFrameHeight = 180; } if (room && maxFrameHeight !== newMaxFrameHeight) { maxFrameHeight = newMaxFrameHeight; room.setReceiverVideoConstraint(maxFrameHeight); } } /** * */ function setNumberOfParticipants() { $('#participants').text(numParticipants); updateMaxFrameHeight(); } /** * Handles local tracks. * @param tracks Array with JitsiTrack objects */ function onLocalTracks(tracks = []) { localTracks = tracks; for (let i = 0; i < localTracks.length; i++) { if (localTracks[i].getType() === 'video') { $('body').append(`