From 08f2edf350ef63e4d1d58cabead3c6366b7c8a90 Mon Sep 17 00:00:00 2001 From: virtuacoplenny Date: Wed, 6 Mar 2019 21:46:17 -0800 Subject: [PATCH] feat(screenshare): emit source type when starting screenshare (#3959) * feat(screenshare): emit source type when starting screenshare * squash: update doc --- conference.js | 9 ++++++++- doc/api.md | 9 ++++++++- modules/API/API.js | 9 +++++++-- 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/conference.js b/conference.js index 73017dd40..4eb0f7002 100644 --- a/conference.js +++ b/conference.js @@ -1326,7 +1326,14 @@ export default { this.isSharingScreen = newStream && newStream.videoType === 'desktop'; if (wasSharingScreen !== this.isSharingScreen) { - APP.API.notifyScreenSharingStatusChanged(this.isSharingScreen); + const details = {}; + + if (this.isSharingScreen) { + details.sourceType = newStream.sourceType; + } + + APP.API.notifyScreenSharingStatusChanged( + this.isSharingScreen, details); } }, diff --git a/doc/api.md b/doc/api.md index 4de9ccda7..db7c89590 100644 --- a/doc/api.md +++ b/doc/api.md @@ -168,7 +168,14 @@ changes. The listener will receive an object with the following structure: * **screenSharingStatusChanged** - receives event notifications about turning on/off the local user screen sharing. The listener will receive object with the following structure: ```javascript { -"on": on //whether screen sharing is on +"on": on, //whether screen sharing is on +"details": { + + // From where the screen sharing is capturing, if known. Values which are + // passed include "window", "screen", "proxy", "device". The value undefined + // will be passed if the source type is unknown or screen share is off. + sourceType: sourceType +} } ``` diff --git a/modules/API/API.js b/modules/API/API.js index 773813d58..460f806b6 100644 --- a/modules/API/API.js +++ b/modules/API/API.js @@ -556,12 +556,17 @@ class API { * has been turned on/off. * * @param {boolean} on - True if screen sharing is enabled. + * @param {Object} details - Additional information about the screen + * sharing. + * @param {string} details.sourceType - Type of device or window the screen + * share is capturing. * @returns {void} */ - notifyScreenSharingStatusChanged(on: boolean) { + notifyScreenSharingStatusChanged(on: boolean, details: Object) { this._sendEvent({ name: 'screen-sharing-status-changed', - on + on, + details }); }