feat(external_api): Add command for setting send/recv video quality
This commit is contained in:
parent
b3f16926d4
commit
a48aa2b999
|
@ -275,6 +275,10 @@ api.executeCommand('avatarUrl', 'https://avatars0.githubusercontent.com/u/367164
|
||||||
```javascript
|
```javascript
|
||||||
api.executeCommand('receiverParticipantId', 'text');
|
api.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:
|
You can also execute multiple commands using the `executeCommands` method:
|
||||||
```javascript
|
```javascript
|
||||||
|
|
|
@ -14,6 +14,7 @@ import { parseJWTFromURLParams } from '../../react/features/base/jwt';
|
||||||
import { setE2EEKey } from '../../react/features/e2ee';
|
import { setE2EEKey } from '../../react/features/e2ee';
|
||||||
import { invite } from '../../react/features/invite';
|
import { invite } from '../../react/features/invite';
|
||||||
import { toggleTileView } from '../../react/features/video-layout';
|
import { toggleTileView } from '../../react/features/video-layout';
|
||||||
|
import { setVideoQuality } from '../../react/features/video-quality';
|
||||||
import { getJitsiMeetTransport } from '../transport';
|
import { getJitsiMeetTransport } from '../transport';
|
||||||
|
|
||||||
import { API_ID, ENDPOINT_TEXT_MESSAGE_NAME } from './constants';
|
import { API_ID, ENDPOINT_TEXT_MESSAGE_NAME } from './constants';
|
||||||
|
@ -171,6 +172,11 @@ function initCommands() {
|
||||||
'e2ee-key': key => {
|
'e2ee-key': key => {
|
||||||
logger.debug('Set E2EE key command received');
|
logger.debug('Set E2EE key command received');
|
||||||
APP.store.dispatch(setE2EEKey(key));
|
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 }) => {
|
transport.on('event', ({ data, name }) => {
|
||||||
|
|
|
@ -35,6 +35,7 @@ const commands = {
|
||||||
password: 'password',
|
password: 'password',
|
||||||
sendEndpointTextMessage: 'send-endpoint-text-message',
|
sendEndpointTextMessage: 'send-endpoint-text-message',
|
||||||
sendTones: 'send-tones',
|
sendTones: 'send-tones',
|
||||||
|
setVideoQuality: 'set-video-quality',
|
||||||
subject: 'subject',
|
subject: 'subject',
|
||||||
submitFeedback: 'submit-feedback',
|
submitFeedback: 'submit-feedback',
|
||||||
toggleAudio: 'toggle-audio',
|
toggleAudio: 'toggle-audio',
|
||||||
|
|
|
@ -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}`);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
}
|
|
@ -1 +1,2 @@
|
||||||
export * from './components';
|
export * from './components';
|
||||||
|
export * from './actions';
|
||||||
|
|
Loading…
Reference in New Issue