Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
ref(large-video): combine selectParticipant logic from web (#3266)
virtuacoplennyafd2aea79c26
diff --git a/conference.js b/conference.jsindex 7c31dfe9af..ccbab62910 100644--- a/conference.js+++ b/conference.js@@ -7,8 +7,6 @@ import Recorder from './modules/recorder/Recorder';import mediaDeviceHelper from './modules/devices/mediaDeviceHelper';-import { reportError } from './modules/util/helpers';-import * as RemoteControlEventsfrom './service/remotecontrol/RemoteControlEvents';import UIEvents from './service/UI/UIEvents';@@ -18,7 +16,6 @@ import * as JitsiMeetConferenceEvents from './ConferenceEvents';import {createDeviceChangedEvent,createScreenSharingEvent,- createSelectParticipantFailedEvent,createStreamSwitchDelayEvent,createTrackMutedEvent,sendAnalytics@@ -1813,24 +1810,6 @@ export default {room.sendTextMessage(message);});}-- APP.UI.addListener(UIEvents.SELECTED_ENDPOINT, id => {- APP.API.notifyOnStageParticipantChanged(id);- try {- // do not try to select participant if there is none (we- // are alone in the room), otherwise an error will be- // thrown cause reporting mechanism is not available- // (datachannels currently)- if (room.getParticipants().length === 0) {- return;- }-- room.selectParticipant(id);- } catch (e) {- sendAnalytics(createSelectParticipantFailedEvent(e));- reportError(e);- }- });}room.on(JitsiConferenceEvents.CONNECTION_INTERRUPTED, () => {diff --git a/modules/UI/videolayout/VideoLayout.js b/modules/UI/videolayout/VideoLayout.jsindex adeeb0f354..5960ce1351 100644--- a/modules/UI/videolayout/VideoLayout.js+++ b/modules/UI/videolayout/VideoLayout.js@@ -960,7 +960,7 @@ const VideoLayout = {// FIXME video type is not the same thing as container typeif (id !== currentId && videoType === VIDEO_CONTAINER_TYPE) {- eventEmitter.emit(UIEvents.SELECTED_ENDPOINT, id);+ APP.API.notifyOnStageParticipantChanged(id);}let oldSmallVideo;diff --git a/react/features/large-video/actions.js b/react/features/large-video/actions.jsindex f85f97b674..73530767e3 100644--- a/react/features/large-video/actions.js+++ b/react/features/large-video/actions.js@@ -1,14 +1,19 @@// @flow+import {+ createSelectParticipantFailedEvent,+ sendAnalytics+} from '../analytics';import { _handleParticipantError } from '../base/conference';-import { MEDIA_TYPE, VIDEO_TYPE } from '../base/media';-import { getTrackByMediaTypeAndParticipant } from '../base/tracks';+import { MEDIA_TYPE } from '../base/media';import {SELECT_LARGE_VIDEO_PARTICIPANT,UPDATE_KNOWN_LARGE_VIDEO_RESOLUTION} from './actionTypes';+declare var APP: Object;+/*** Signals conference to select a participant.*@@ -21,22 +26,23 @@ export function selectParticipant() {if (conference) {const largeVideo = state['features/large-video'];- const tracks = state['features/base/tracks'];-const id = largeVideo.participantId;- const videoTrack- = getTrackByMediaTypeAndParticipant(- tracks,- MEDIA_TYPE.VIDEO,- id);try {- conference.selectParticipant(- videoTrack && videoTrack.videoType === VIDEO_TYPE.CAMERA- ? id- : null);+ conference.selectParticipant(id);} catch (err) {_handleParticipantError(err);++ sendAnalytics(createSelectParticipantFailedEvent(err));++ if (typeof APP === 'object' && window.onerror) {+ window.onerror(+ `Failed to select participant ${id}`,+ null, // source+ null, // lineno+ null, // colno+ err);+ }}}};diff --git a/react/features/large-video/middleware.js b/react/features/large-video/middleware.jsindex 60115dbe12..96bfb2491a 100644--- a/react/features/large-video/middleware.js+++ b/react/features/large-video/middleware.js@@ -1,5 +1,6 @@// @flow+import { CONFERENCE_JOINED } from '../base/conference';import {DOMINANT_SPEAKER_CHANGED,PARTICIPANT_JOINED,@@ -46,6 +47,13 @@ MiddlewareRegistry.register(store => next => action => {store.dispatch(selectParticipantInLargeVideo());break;+ case CONFERENCE_JOINED:+ // Ensure a participant is selected on conference join. This addresses+ // the case where video tracks were received before CONFERENCE_JOINED+ // fired; without the conference selection may not happen.+ store.dispatch(selectParticipant());+ break;+case TRACK_UPDATED:// In order to minimize re-calculations, we need to select participant// only if the videoType of the current participant rendered indiff --git a/service/UI/UIEvents.js b/service/UI/UIEvents.jsindex 545f10a456..2fcda6a94a 100644--- a/service/UI/UIEvents.js+++ b/service/UI/UIEvents.js@@ -1,6 +1,5 @@export default {NICKNAME_CHANGED: 'UI.nickname_changed',- SELECTED_ENDPOINT: 'UI.selected_endpoint',PINNED_ENDPOINT: 'UI.pinned_endpoint',/**