Quellcode durchsuchen

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

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

* squash: update doc
j8
virtuacoplenny vor 6 Jahren
Ursprung
Commit
08f2edf350
Es ist kein Account mit der E-Mail-Adresse des Committers verbunden
3 geänderte Dateien mit 23 neuen und 4 gelöschten Zeilen
  1. 8
    1
      conference.js
  2. 8
    1
      doc/api.md
  3. 7
    2
      modules/API/API.js

+ 8
- 1
conference.js Datei anzeigen

@@ -1326,7 +1326,14 @@ export default {
1326 1326
         this.isSharingScreen = newStream && newStream.videoType === 'desktop';
1327 1327
 
1328 1328
         if (wasSharingScreen !== this.isSharingScreen) {
1329
-            APP.API.notifyScreenSharingStatusChanged(this.isSharingScreen);
1329
+            const details = {};
1330
+
1331
+            if (this.isSharingScreen) {
1332
+                details.sourceType = newStream.sourceType;
1333
+            }
1334
+
1335
+            APP.API.notifyScreenSharingStatusChanged(
1336
+                this.isSharingScreen, details);
1330 1337
         }
1331 1338
     },
1332 1339
 

+ 8
- 1
doc/api.md Datei anzeigen

@@ -168,7 +168,14 @@ changes. The listener will receive an object with the following structure:
168 168
 * **screenSharingStatusChanged** - receives event notifications about turning on/off the local user screen sharing. The listener will receive object with the following structure:
169 169
 ```javascript
170 170
 {
171
-"on": on //whether screen sharing is on
171
+"on": on, //whether screen sharing is on
172
+"details": {
173
+
174
+    // From where the screen sharing is capturing, if known. Values which are
175
+    // passed include "window", "screen", "proxy", "device". The value undefined
176
+    // will be passed if the source type is unknown or screen share is off.
177
+    sourceType: sourceType
178
+}
172 179
 }
173 180
 ```
174 181
 

+ 7
- 2
modules/API/API.js Datei anzeigen

@@ -556,12 +556,17 @@ class API {
556 556
      * has been turned on/off.
557 557
      *
558 558
      * @param {boolean} on - True if screen sharing is enabled.
559
+     * @param {Object} details - Additional information about the screen
560
+     * sharing.
561
+     * @param {string} details.sourceType - Type of device or window the screen
562
+     * share is capturing.
559 563
      * @returns {void}
560 564
      */
561
-    notifyScreenSharingStatusChanged(on: boolean) {
565
+    notifyScreenSharingStatusChanged(on: boolean, details: Object) {
562 566
         this._sendEvent({
563 567
             name: 'screen-sharing-status-changed',
564
-            on
568
+            on,
569
+            details
565 570
         });
566 571
     }
567 572
 

Laden…
Abbrechen
Speichern