feat(video-quality): add iframe event and getter.

This commit is contained in:
Hristo Terezov 2020-09-03 17:40:54 -05:00
parent 25839b18d2
commit fc75d45c6c
4 changed files with 33 additions and 0 deletions

View File

@ -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.

View File

@ -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.
*

View File

@ -152,6 +152,7 @@ export default [
'testing',
'useStunTurn',
'useTurnUdp',
'videoQuality.persist',
'webrtcIceTcpDisable',
'webrtcIceUdpDisable'
].concat(extraConfigWhitelist);

View File

@ -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);
}
});