浏览代码

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

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

* squash: update doc
j8
virtuacoplenny 6 年前
父节点
当前提交
08f2edf350
没有帐户链接到提交者的电子邮件
共有 3 个文件被更改,包括 23 次插入4 次删除
  1. 8
    1
      conference.js
  2. 8
    1
      doc/api.md
  3. 7
    2
      modules/API/API.js

+ 8
- 1
conference.js 查看文件

1326
         this.isSharingScreen = newStream && newStream.videoType === 'desktop';
1326
         this.isSharingScreen = newStream && newStream.videoType === 'desktop';
1327
 
1327
 
1328
         if (wasSharingScreen !== this.isSharingScreen) {
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 查看文件

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

556
      * has been turned on/off.
556
      * has been turned on/off.
557
      *
557
      *
558
      * @param {boolean} on - True if screen sharing is enabled.
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
      * @returns {void}
563
      * @returns {void}
560
      */
564
      */
561
-    notifyScreenSharingStatusChanged(on: boolean) {
565
+    notifyScreenSharingStatusChanged(on: boolean, details: Object) {
562
         this._sendEvent({
566
         this._sendEvent({
563
             name: 'screen-sharing-status-changed',
567
             name: 'screen-sharing-status-changed',
564
-            on
568
+            on,
569
+            details
565
         });
570
         });
566
     }
571
     }
567
 
572
 

正在加载...
取消
保存