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
feat(external_api): Add command for setting send/recv video quality
Jaya Allamsettya48aa2b999d5
diff --git a/doc/api.md b/doc/api.mdindex 85b1e8d607..08961f2b97 100644--- a/doc/api.md+++ b/doc/api.md@@ -275,6 +275,10 @@ api.executeCommand('avatarUrl', 'https://avatars0.githubusercontent.com/u/367164```javascriptapi.executeCommand('receiverParticipantId', 'text');```+* **setVideoQuality** - Sets the send and receive video resolution. This command requires one argument - the resolution height to be set.+```javascript+api.executeCommand('setVideoQuality', 720);+```You can also execute multiple commands using the `executeCommands` method:```javascriptdiff --git a/modules/API/API.js b/modules/API/API.jsindex 7adec2f62a..791e7c4ee4 100644--- a/modules/API/API.js+++ b/modules/API/API.js@@ -14,6 +14,7 @@ import { parseJWTFromURLParams } from '../../react/features/base/jwt';import { setE2EEKey } from '../../react/features/e2ee';import { invite } from '../../react/features/invite';import { toggleTileView } from '../../react/features/video-layout';+import { setVideoQuality } from '../../react/features/video-quality';import { getJitsiMeetTransport } from '../transport';import { API_ID, ENDPOINT_TEXT_MESSAGE_NAME } from './constants';@@ -171,6 +172,11 @@ function initCommands() {'e2ee-key': key => {logger.debug('Set E2EE key command received');APP.store.dispatch(setE2EEKey(key));+ },+ 'set-video-quality': frameHeight => {+ logger.debug('Set video quality command received');+ sendAnalytics(createApiEvent('set.video.quality'));+ APP.store.dispatch(setVideoQuality(frameHeight));}};transport.on('event', ({ data, name }) => {diff --git a/modules/API/external/external_api.js b/modules/API/external/external_api.jsindex a79faf3bb6..1cba279d23 100644--- a/modules/API/external/external_api.js+++ b/modules/API/external/external_api.js@@ -35,6 +35,7 @@ const commands = {password: 'password',sendEndpointTextMessage: 'send-endpoint-text-message',sendTones: 'send-tones',+ setVideoQuality: 'set-video-quality',subject: 'subject',submitFeedback: 'submit-feedback',toggleAudio: 'toggle-audio',diff --git a/react/features/video-quality/actions.js b/react/features/video-quality/actions.jsnew file mode 100644index 0000000000..662310083a--- /dev/null+++ b/react/features/video-quality/actions.js@@ -0,0 +1,31 @@+// @flow++import { VIDEO_QUALITY_LEVELS } from '../base/conference';+import logger from './logger';++import type { Dispatch } from 'redux';++/**+ * Sets the maximum video size the local participant should send and receive from+ * remote participants.+ *+ * @param {number} frameHeight - The user preferred max frame height for send and+ * receive video.+ * @returns {void}+ */+export function setVideoQuality(frameHeight: number) {+ return (dispatch: Dispatch<any>, getState: Function) => {+ const { conference, maxReceiverVideoQuality } = getState()['features/base/conference'];++ if (frameHeight < VIDEO_QUALITY_LEVELS.LOW) {+ logger.error(`Invalid frame height for video quality - ${frameHeight}`);++ return;+ }+ conference.setReceiverVideoConstraint(Math.min(frameHeight, maxReceiverVideoQuality));+ conference.setSenderVideoConstraint(Math.min(frameHeight, VIDEO_QUALITY_LEVELS.HIGH))+ .catch(err => {+ logger.error(`Set video quality command failed - ${err}`);+ });+ };+}diff --git a/react/features/video-quality/index.js b/react/features/video-quality/index.jsindex 07635cbbc8..a6be211266 100644--- a/react/features/video-quality/index.js+++ b/react/features/video-quality/index.js@@ -1 +1,2 @@export * from './components';+export * from './actions';