feat(api): add ability to toggle tile view
This commit is contained in:
parent
149485905c
commit
37b343a797
12
doc/api.md
12
doc/api.md
|
@ -222,6 +222,11 @@ api.executeCommand('toggleChat');
|
||||||
api.executeCommand('toggleShareScreen');
|
api.executeCommand('toggleShareScreen');
|
||||||
```
|
```
|
||||||
|
|
||||||
|
* **toggleTileView** - Enter / exit tile view layout mode. No arguments are required.
|
||||||
|
```javascript
|
||||||
|
api.executeCommand('toggleTileView');
|
||||||
|
```
|
||||||
|
|
||||||
* **hangup** - Hangups the call. No arguments are required.
|
* **hangup** - Hangups the call. No arguments are required.
|
||||||
```javascript
|
```javascript
|
||||||
api.executeCommand('hangup');
|
api.executeCommand('hangup');
|
||||||
|
@ -296,6 +301,13 @@ changes. The listener will receive an object with the following structure:
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
* **tileViewChanged** - event notifications about tile view layout mode being entered or exited. The listener will receive object with the following structure:
|
||||||
|
```javascript
|
||||||
|
{
|
||||||
|
enabled: boolean, // whether tile view is not displayed or not
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
* **incomingMessage** - Event notifications about incoming
|
* **incomingMessage** - Event notifications about incoming
|
||||||
messages. The listener will receive an object with the following structure:
|
messages. The listener will receive an object with the following structure:
|
||||||
```javascript
|
```javascript
|
||||||
|
|
|
@ -8,6 +8,7 @@ import {
|
||||||
import { setSubject } from '../../react/features/base/conference';
|
import { setSubject } from '../../react/features/base/conference';
|
||||||
import { parseJWTFromURLParams } from '../../react/features/base/jwt';
|
import { parseJWTFromURLParams } from '../../react/features/base/jwt';
|
||||||
import { invite } from '../../react/features/invite';
|
import { invite } from '../../react/features/invite';
|
||||||
|
import { toggleTileView } from '../../react/features/video-layout';
|
||||||
import { getJitsiMeetTransport } from '../transport';
|
import { getJitsiMeetTransport } from '../transport';
|
||||||
|
|
||||||
import { API_ID } from './constants';
|
import { API_ID } from './constants';
|
||||||
|
@ -97,6 +98,11 @@ function initCommands() {
|
||||||
sendAnalytics(createApiEvent('screen.sharing.toggled'));
|
sendAnalytics(createApiEvent('screen.sharing.toggled'));
|
||||||
toggleScreenSharing();
|
toggleScreenSharing();
|
||||||
},
|
},
|
||||||
|
'toggle-tile-view': () => {
|
||||||
|
sendAnalytics(createApiEvent('tile-view.toggled'));
|
||||||
|
|
||||||
|
APP.store.dispatch(toggleTileView());
|
||||||
|
},
|
||||||
'video-hangup': () => {
|
'video-hangup': () => {
|
||||||
sendAnalytics(createApiEvent('video.hangup'));
|
sendAnalytics(createApiEvent('video.hangup'));
|
||||||
APP.conference.hangup(true);
|
APP.conference.hangup(true);
|
||||||
|
@ -622,6 +628,21 @@ class API {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notify external application (if API is enabled) that tile view has been
|
||||||
|
* entered or exited.
|
||||||
|
*
|
||||||
|
* @param {string} enabled - True if tile view is currently displayed, false
|
||||||
|
* otherwise.
|
||||||
|
* @returns {void}
|
||||||
|
*/
|
||||||
|
notifyTileViewChanged(enabled: boolean) {
|
||||||
|
this._sendEvent({
|
||||||
|
name: 'tile-view-changed',
|
||||||
|
enabled
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Disposes the allocated resources.
|
* Disposes the allocated resources.
|
||||||
*
|
*
|
||||||
|
|
|
@ -39,6 +39,7 @@ const commands = {
|
||||||
toggleChat: 'toggle-chat',
|
toggleChat: 'toggle-chat',
|
||||||
toggleFilmStrip: 'toggle-film-strip',
|
toggleFilmStrip: 'toggle-film-strip',
|
||||||
toggleShareScreen: 'toggle-share-screen',
|
toggleShareScreen: 'toggle-share-screen',
|
||||||
|
toggleTileView: 'toggle-tile-view',
|
||||||
toggleVideo: 'toggle-video'
|
toggleVideo: 'toggle-video'
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -67,7 +68,8 @@ const events = {
|
||||||
'video-availability-changed': 'videoAvailabilityChanged',
|
'video-availability-changed': 'videoAvailabilityChanged',
|
||||||
'video-mute-status-changed': 'videoMuteStatusChanged',
|
'video-mute-status-changed': 'videoMuteStatusChanged',
|
||||||
'screen-sharing-status-changed': 'screenSharingStatusChanged',
|
'screen-sharing-status-changed': 'screenSharingStatusChanged',
|
||||||
'subject-change': 'subjectChange'
|
'subject-change': 'subjectChange',
|
||||||
|
'tile-view-changed': 'tileViewChanged'
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
|
import type { Dispatch } from 'redux';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
SCREEN_SHARE_PARTICIPANTS_UPDATED,
|
SCREEN_SHARE_PARTICIPANTS_UPDATED,
|
||||||
SET_TILE_VIEW
|
SET_TILE_VIEW
|
||||||
|
@ -39,3 +41,17 @@ export function setTileView(enabled: boolean) {
|
||||||
enabled
|
enabled
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a (redux) action which signals either to exit tile view if currently
|
||||||
|
* enabled or enter tile view if currently disabled.
|
||||||
|
*
|
||||||
|
* @returns {Function}
|
||||||
|
*/
|
||||||
|
export function toggleTileView() {
|
||||||
|
return (dispatch: Dispatch<any>, getState: Function) => {
|
||||||
|
const { tileViewEnabled } = getState()['features/video-layout'];
|
||||||
|
|
||||||
|
dispatch(setTileView(!tileViewEnabled));
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@ import { selectParticipant } from '../large-video';
|
||||||
import { shouldDisplayTileView } from './functions';
|
import { shouldDisplayTileView } from './functions';
|
||||||
import { setParticipantsWithScreenShare } from './actions';
|
import { setParticipantsWithScreenShare } from './actions';
|
||||||
|
|
||||||
|
declare var APP: Object;
|
||||||
declare var interfaceConfig: Object;
|
declare var interfaceConfig: Object;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -35,6 +36,10 @@ StateListenerRegistry.register(
|
||||||
_updateAutoPinnedParticipant(store);
|
_updateAutoPinnedParticipant(store);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (typeof APP === 'object') {
|
||||||
|
APP.API.notifyTileViewChanged(displayTileView);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue