diff --git a/modules/API/API.js b/modules/API/API.js index 2f0ce13ba..272ff0f63 100644 --- a/modules/API/API.js +++ b/modules/API/API.js @@ -524,6 +524,19 @@ class API { }); } + /** + * Notify external application that the video quality setting has changed. + * + * @param {number} videoQuality - The video quality. The number represents the maximum height of the video streams. + * @returns {void} + */ + notifyVideoQualityChanged(videoQuality: number) { + this._sendEvent({ + name: 'video-quality-changed', + videoQuality + }); + } + /** * Notify external application (if API is enabled) that message was * received. diff --git a/modules/API/external/external_api.js b/modules/API/external/external_api.js index ab9e613cb..d62edc8bc 100644 --- a/modules/API/external/external_api.js +++ b/modules/API/external/external_api.js @@ -80,6 +80,7 @@ const events = { 'video-conference-left': 'videoConferenceLeft', 'video-availability-changed': 'videoAvailabilityChanged', 'video-mute-status-changed': 'videoMuteStatusChanged', + 'video-quality-changed': 'videoQualityChanged', 'screen-sharing-status-changed': 'screenSharingStatusChanged', 'dominant-speaker-changed': 'dominantSpeakerChanged', 'subject-change': 'subjectChange', @@ -503,6 +504,9 @@ export default class JitsiMeetExternalAPI extends EventEmitter { changeParticipantNumber(this, -1); delete this._participants[this._myUserID]; break; + case 'video-quality-changed': + this._videoQuality = data.videoQuality; + break; } const eventName = events[name]; @@ -689,6 +693,15 @@ export default class JitsiMeetExternalAPI extends EventEmitter { return getCurrentDevices(this._transport); } + /** + * Returns the current video quality setting. + * + * @returns {number} + */ + getVideoQuality() { + return this._videoQuality; + } + /** * Check if the audio is available. * diff --git a/react/features/base/config/configWhitelist.js b/react/features/base/config/configWhitelist.js index 0cca42780..20c0fc3df 100644 --- a/react/features/base/config/configWhitelist.js +++ b/react/features/base/config/configWhitelist.js @@ -152,6 +152,7 @@ export default [ 'testing', 'useStunTurn', 'useTurnUdp', + 'videoQuality.persist', 'webrtcIceTcpDisable', 'webrtcIceUdpDisable' ].concat(extraConfigWhitelist); diff --git a/react/features/video-quality/middleware.js b/react/features/video-quality/middleware.js index 501141e90..ba67f1ad1 100644 --- a/react/features/video-quality/middleware.js +++ b/react/features/video-quality/middleware.js @@ -15,6 +15,8 @@ import { getReceiverVideoQualityLevel } from './functions'; import logger from './logger'; import { getMinHeightForQualityLvlMap } from './selector'; +declare var APP: Object; + /** * Implements the middleware of the feature video-quality. * @@ -213,4 +215,8 @@ StateListenerRegistry.register( if (changedConference || changedPreferredVideoQuality) { _setSenderVideoConstraint(conference, preferredVideoQuality); } + + if (typeof APP !== 'undefined' && changedPreferredVideoQuality) { + APP.API.notifyVideoQualityChanged(preferredVideoQuality); + } });