Selaa lähdekoodia

fix(SS): Add toggle parameter

j8
hristoterezov 8 vuotta sitten
vanhempi
commit
cfe7e30550
1 muutettua tiedostoa jossa 9 lisäystä ja 3 poistoa
  1. 9
    3
      conference.js

+ 9
- 3
conference.js Näytä tiedosto

@@ -1359,7 +1359,13 @@ export default {
1359 1359
     },
1360 1360
 
1361 1361
     /**
1362
-     * Toggles between screensharing and camera video.
1362
+     * Toggles between screen sharing and camera video if the toggle parameter
1363
+     * is not specified and starts the procedure for obtaining new screen
1364
+     * sharing/video track otherwise.
1365
+     *
1366
+     * @param {boolean} [toggle] - If true - new screen sharing track will be
1367
+     * obtained. If false - new video track will be obtain. If not specified -
1368
+     * toggles between screen sharing and camera video.
1363 1369
      * @param {Object} [options] - Screen sharing options that will be passed to
1364 1370
      * createLocalTracks.
1365 1371
      * @param {Array<string>} [options.desktopSharingSources] - Array with the
@@ -1367,7 +1373,7 @@ export default {
1367 1373
      * 'window', etc.).
1368 1374
      * @return {Promise.<T>}
1369 1375
      */
1370
-    toggleScreenSharing(options = {}) {
1376
+    toggleScreenSharing(toggle = !this._untoggleScreenSharing, options = {}) {
1371 1377
         if (this.videoSwitchInProgress) {
1372 1378
             return Promise.reject('Switch in progress.');
1373 1379
         }
@@ -1382,7 +1388,7 @@ export default {
1382 1388
             return Promise.reject('No screensharing in audio only mode');
1383 1389
         }
1384 1390
 
1385
-        if (!this._untoggleScreenSharing) {
1391
+        if (toggle) {
1386 1392
             return this._switchToScreenSharing(options);
1387 1393
         } else {
1388 1394
             return this._untoggleScreenSharing();

Loading…
Peruuta
Tallenna