Преглед на файлове

fix(SS): Add toggle parameter

master
hristoterezov преди 8 години
родител
ревизия
cfe7e30550
променени са 1 файла, в които са добавени 9 реда и са изтрити 3 реда
  1. 9
    3
      conference.js

+ 9
- 3
conference.js Целия файл

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
      * @param {Object} [options] - Screen sharing options that will be passed to
1369
      * @param {Object} [options] - Screen sharing options that will be passed to
1364
      * createLocalTracks.
1370
      * createLocalTracks.
1365
      * @param {Array<string>} [options.desktopSharingSources] - Array with the
1371
      * @param {Array<string>} [options.desktopSharingSources] - Array with the
1367
      * 'window', etc.).
1373
      * 'window', etc.).
1368
      * @return {Promise.<T>}
1374
      * @return {Promise.<T>}
1369
      */
1375
      */
1370
-    toggleScreenSharing(options = {}) {
1376
+    toggleScreenSharing(toggle = !this._untoggleScreenSharing, options = {}) {
1371
         if (this.videoSwitchInProgress) {
1377
         if (this.videoSwitchInProgress) {
1372
             return Promise.reject('Switch in progress.');
1378
             return Promise.reject('Switch in progress.');
1373
         }
1379
         }
1382
             return Promise.reject('No screensharing in audio only mode');
1388
             return Promise.reject('No screensharing in audio only mode');
1383
         }
1389
         }
1384
 
1390
 
1385
-        if (!this._untoggleScreenSharing) {
1391
+        if (toggle) {
1386
             return this._switchToScreenSharing(options);
1392
             return this._switchToScreenSharing(options);
1387
         } else {
1393
         } else {
1388
             return this._untoggleScreenSharing();
1394
             return this._untoggleScreenSharing();

Loading…
Отказ
Запис