Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

feat(external-api) support assumed bandwidth bps config and command (#13164)

Mihaela Dumitru9f39caa247e4
diff --git a/modules/API/API.js b/modules/API/API.js
index 91778b95ac..8e23ad4943 100644
--- a/modules/API/API.js
+++ b/modules/API/API.js
@@ -115,7 +115,11 @@ import { muteAllParticipants } from '../../react/features/video-menu/actions';
import { setVideoQuality } from '../../react/features/video-quality/actions';
import { getJitsiMeetTransport } from '../transport';
-import { API_ID, ENDPOINT_TEXT_MESSAGE_NAME } from './constants';
+import {
+ API_ID,
+ ASSUMED_BANDWIDTH_BPS,
+ ENDPOINT_TEXT_MESSAGE_NAME
+} from './constants';
const logger = Logger.getLogger(__filename);
@@ -310,6 +314,23 @@ function initCommands() {
APP.store.dispatch(sendTones(tones, duration, pause));
},
+ 'set-assumed-bandwidth-bps': value => {
+ logger.debug('Set assumed bandwidth bps command received', value);
+
+ if (typeof value !== 'number' || isNaN(value)) {
+ logger.error('Assumed bandwidth bps must be a number.');
+
+ return;
+ }
+
+ const { conference } = APP.store.getState()['features/base/conference'];
+
+ if (conference) {
+ conference.setAssumedBandwidthBps(value < ASSUMED_BANDWIDTH_BPS
+ ? ASSUMED_BANDWIDTH_BPS
+ : value);
+ }
+ },
'set-follow-me': value => {
logger.debug('Set follow me command received');
diff --git a/modules/API/constants.js b/modules/API/constants.js
index 9212979ca2..d06e281215 100644
--- a/modules/API/constants.js
+++ b/modules/API/constants.js
@@ -15,3 +15,10 @@ export const API_ID = parseURLParams(window.location).jitsi_meet_external_api_id
* The payload name for the datachannel/endpoint text message event.
*/
export const ENDPOINT_TEXT_MESSAGE_NAME = 'endpoint-text-message';
+
+/**
+ * The min value that can be set for the assumed bandwidth.
+ * Setting it to this value means not assuming any bandwidth,
+ * but rather allowing the estimations to take place.
+ */
+export const ASSUMED_BANDWIDTH_BPS = -1;
diff --git a/modules/API/external/external_api.js b/modules/API/external/external_api.js
index 79f36834c4..329b0528f4 100644
--- a/modules/API/external/external_api.js
+++ b/modules/API/external/external_api.js
@@ -59,6 +59,7 @@ const commands = {
sendEndpointTextMessage: 'send-endpoint-text-message',
sendParticipantToRoom: 'send-participant-to-room',
sendTones: 'send-tones',
+ setAssumedBandwidthBps: 'set-assumed-bandwidth-bps',
setFollowMe: 'set-follow-me',
setLargeVideoParticipant: 'set-large-video-participant',
setMediaEncryptionKey: 'set-media-encryption-key',
diff --git a/react/features/base/conference/reducer.ts b/react/features/base/conference/reducer.ts
index 0d0557b401..6d4b568f80 100644
--- a/react/features/base/conference/reducer.ts
+++ b/react/features/base/conference/reducer.ts
@@ -104,6 +104,7 @@ export interface IJitsiConference {
sendTextMessage: Function;
sendTones: Function;
sessionId: string;
+ setAssumedBandwidthBps: (value: number) => void;
setDesktopSharingFrameRate: Function;
setDisplayName: Function;
setLocalParticipantProperty: Function;