feat(screenshare): emit source type when starting screenshare (#3959)

* feat(screenshare): emit source type when starting screenshare

* squash: update doc
This commit is contained in:
virtuacoplenny 2019-03-06 21:46:17 -08:00 committed by GitHub
parent 98c7430b6f
commit 08f2edf350
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 4 deletions

View File

@ -1326,7 +1326,14 @@ export default {
this.isSharingScreen = newStream && newStream.videoType === 'desktop'; this.isSharingScreen = newStream && newStream.videoType === 'desktop';
if (wasSharingScreen !== this.isSharingScreen) { if (wasSharingScreen !== this.isSharingScreen) {
APP.API.notifyScreenSharingStatusChanged(this.isSharingScreen); const details = {};
if (this.isSharingScreen) {
details.sourceType = newStream.sourceType;
}
APP.API.notifyScreenSharingStatusChanged(
this.isSharingScreen, details);
} }
}, },

View File

@ -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: * **screenSharingStatusChanged** - receives event notifications about turning on/off the local user screen sharing. The listener will receive object with the following structure:
```javascript ```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
}
} }
``` ```

View File

@ -556,12 +556,17 @@ class API {
* has been turned on/off. * has been turned on/off.
* *
* @param {boolean} on - True if screen sharing is enabled. * @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} * @returns {void}
*/ */
notifyScreenSharingStatusChanged(on: boolean) { notifyScreenSharingStatusChanged(on: boolean, details: Object) {
this._sendEvent({ this._sendEvent({
name: 'screen-sharing-status-changed', name: 'screen-sharing-status-changed',
on on,
details
}); });
} }