From b6792db65fe7e42ebb0a05dadae6a5756d4b2093 Mon Sep 17 00:00:00 2001 From: Jaya Allamsetty Date: Mon, 14 Sep 2020 16:01:46 -0400 Subject: [PATCH] feat(external_api): Add cmd for selecting a user to be displayed in large video --- modules/API/API.js | 9 +++++++-- modules/API/external/external_api.js | 1 + react/features/large-video/actions.js | 13 ++++++++----- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/modules/API/API.js b/modules/API/API.js index 22e8b276c..1f94e8853 100644 --- a/modules/API/API.js +++ b/modules/API/API.js @@ -21,6 +21,7 @@ import { import { isEnabled as isDropboxEnabled } from '../../react/features/dropbox'; import { toggleE2EE } from '../../react/features/e2ee/actions'; import { invite } from '../../react/features/invite'; +import { selectParticipantInLargeVideo } from '../../react/features/large-video/actions'; import { toggleLobbyMode } from '../../react/features/lobby/actions.web'; import { RECORDING_TYPES } from '../../react/features/recording/constants'; import { getActiveSession } from '../../react/features/recording/functions'; @@ -123,6 +124,11 @@ function initCommands() { APP.store.dispatch(sendTones(tones, duration, pause)); }, + 'set-large-video-participant': participantId => { + logger.debug('Set large video participant command received'); + sendAnalytics(createApiEvent('largevideo.participant.changed')); + APP.store.dispatch(selectParticipantInLargeVideo(participantId)); + }, 'subject': subject => { sendAnalytics(createApiEvent('subject.changed')); APP.store.dispatch(setSubject(subject)); @@ -710,8 +716,7 @@ class API { } /** - * Notify external application (if API is enabled) that user changed their - * nickname. + * Notify external application (if API is enabled) that local user has left the conference. * * @param {string} roomName - User id. * @returns {void} diff --git a/modules/API/external/external_api.js b/modules/API/external/external_api.js index d62edc8bc..763b01424 100644 --- a/modules/API/external/external_api.js +++ b/modules/API/external/external_api.js @@ -37,6 +37,7 @@ const commands = { password: 'password', sendEndpointTextMessage: 'send-endpoint-text-message', sendTones: 'send-tones', + setLargeVideoParticipant: 'set-large-video-participant', setVideoQuality: 'set-video-quality', startRecording: 'start-recording', stopRecording: 'stop-recording', diff --git a/react/features/large-video/actions.js b/react/features/large-video/actions.js index b1664134f..eb645b975 100644 --- a/react/features/large-video/actions.js +++ b/react/features/large-video/actions.js @@ -49,16 +49,19 @@ export function selectParticipant() { } /** - * Action to select the participant to be displayed in LargeVideo based on a - * variety of factors: If there is a dominant or pinned speaker, or if there are - * remote tracks, etc. + * Action to select the participant to be displayed in LargeVideo based on the + * participant id provided. If a partcipant id is not provided, the LargeVideo + * participant will be selected based on a variety of factors: If there is a + * dominant or pinned speaker, or if there are remote tracks, etc. * + * @param {string} participant - The participant id of the user that needs to be + * displayed on the large video. * @returns {Function} */ -export function selectParticipantInLargeVideo() { +export function selectParticipantInLargeVideo(participant: ?string) { return (dispatch: Dispatch, getState: Function) => { const state = getState(); - const participantId = _electParticipantInLargeVideo(state); + const participantId = participant ?? _electParticipantInLargeVideo(state); const largeVideo = state['features/large-video']; if (participantId !== largeVideo.participantId) {