feat(api): allow for explicit screenshare state toggling
This commit is contained in:
parent
1941275f93
commit
bc403adb46
|
@ -1457,7 +1457,9 @@ export default {
|
||||||
return this._switchToScreenSharing(options);
|
return this._switchToScreenSharing(options);
|
||||||
}
|
}
|
||||||
|
|
||||||
return this._untoggleScreenSharing();
|
return this._untoggleScreenSharing
|
||||||
|
? this._untoggleScreenSharing()
|
||||||
|
: Promise.resolve();
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -116,9 +116,19 @@ function initCommands() {
|
||||||
sendAnalytics(createApiEvent('chat.toggled'));
|
sendAnalytics(createApiEvent('chat.toggled'));
|
||||||
APP.UI.toggleChat();
|
APP.UI.toggleChat();
|
||||||
},
|
},
|
||||||
'toggle-share-screen': () => {
|
|
||||||
|
/**
|
||||||
|
* Callback to invoke when the "toggle-share-screen" command is received.
|
||||||
|
*
|
||||||
|
* @param {Object} options - Additional details of how to perform
|
||||||
|
* the action. Note this parameter is undocumented and experimental.
|
||||||
|
* @param {boolean} options.enable - Whether trying to enable screen
|
||||||
|
* sharing or to turn it off.
|
||||||
|
* @returns {void}
|
||||||
|
*/
|
||||||
|
'toggle-share-screen': (options = {}) => {
|
||||||
sendAnalytics(createApiEvent('screen.sharing.toggled'));
|
sendAnalytics(createApiEvent('screen.sharing.toggled'));
|
||||||
toggleScreenSharing();
|
toggleScreenSharing(options.enable);
|
||||||
},
|
},
|
||||||
'toggle-tile-view': () => {
|
'toggle-tile-view': () => {
|
||||||
sendAnalytics(createApiEvent('tile-view.toggled'));
|
sendAnalytics(createApiEvent('tile-view.toggled'));
|
||||||
|
@ -242,13 +252,17 @@ function shouldBeEnabled() {
|
||||||
/**
|
/**
|
||||||
* Executes on toggle-share-screen command.
|
* Executes on toggle-share-screen command.
|
||||||
*
|
*
|
||||||
|
* @param {boolean} [enable] - Whether this toggle is to explicitly enable or
|
||||||
|
* disable screensharing. If not defined, the application will automatically
|
||||||
|
* attempt to toggle between enabled and disabled. This boolean is useful for
|
||||||
|
* explicitly setting desired screensharing state.
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
function toggleScreenSharing() {
|
function toggleScreenSharing(enable) {
|
||||||
if (APP.conference.isDesktopSharingEnabled) {
|
if (APP.conference.isDesktopSharingEnabled) {
|
||||||
|
|
||||||
// eslint-disable-next-line no-empty-function
|
// eslint-disable-next-line no-empty-function
|
||||||
APP.conference.toggleScreenSharing().catch(() => {});
|
APP.conference.toggleScreenSharing(enable).catch(() => {});
|
||||||
} else {
|
} else {
|
||||||
initialScreenSharingState = !initialScreenSharingState;
|
initialScreenSharingState = !initialScreenSharingState;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue