Browse Source

cleanup: Make desktop sharing options consistent and drop deprecated ones

Make sure there are options to set the extension ID and an enabled flag for
both Chrome and Firefox.

Removed checking for deprecated configuration options: desktopSharing,
chromeExtensionId and minChromeExtVersion.
dev1
Saúl Ibarra Corretgé 8 years ago
parent
commit
079f95974b
3 changed files with 37 additions and 55 deletions
  1. 15
    15
      doc/API.md
  2. 2
    2
      doc/example/example.js
  3. 20
    38
      modules/RTC/ScreenObtainer.js

+ 15
- 15
doc/API.md View File

@@ -39,21 +39,21 @@ You can access the following methods and objects trough ```JitsiMeetJS``` object
39 39
 *  ```JitsiMeetJS.init(options)``` - this method initialized Jitsi Meet API.
40 40
 The ```options``` parameter is JS object with the following properties:
41 41
     1. useIPv6 - boolean property
42
-    2. desktopSharingChromeMethod - Desktop sharing method. Can be set to 'ext', 'webrtc' or false to disable.
43
-    3. desktopSharingChromeExtId - The ID of the jidesha extension for Chrome or Firefox. Example: 'mbocklcggfhnbahlnepmldehdhpjfcjp'
44
-    desktopSharingChromeSources - Array of strings with the media sources to use when using screen sharing with the Chrome extension. Example: ['screen', 'window']
45
-    4. desktopSharingChromeMinExtVersion - Required version of Chrome extension. Example: '0.1'
46
-    5. desktopSharingFirefoxExtId - The ID of the jidesha extension for Firefox. If null, we assume that no extension is required.
47
-    6. desktopSharingFirefoxDisabled - Boolean. Whether desktop sharing should be disabled on Firefox. Example: false.
48
-    7. desktopSharingFirefoxMaxVersionExtRequired - The maximum version of Firefox which requires a jidesha extension. Example: if set to 41, we will require the extension for Firefox versions up to and including 41. On Firefox 42 and higher, we will run without the extension. If set to -1, an extension will be required for all versions of Firefox.
49
-    8. desktopSharingFirefoxExtensionURL - The URL to the Firefox extension for desktop sharing. "null" if no extension is required.
50
-    9. disableAudioLevels - boolean property. Enables/disables audio levels.
51
-    10. disableSimulcast - boolean property. Enables/disables simulcast.
52
-    11. enableWindowOnErrorHandler - boolean property (default false). Enables/disables attaching global onerror handler (window.onerror).
53
-    12. disableThirdPartyRequests - if true - callstats will be disabled and the callstats API won't be included.
54
-    13. enableAnalyticsLogging - boolean property (default false). Enables/disables analytics logging.
55
-    14. callStatsCustomScriptUrl - (optional) custom url to access callstats client script
56
-    15. callStatsConfIDNamespace - (optional) a namespace to prepend the callstats conference ID with. Defaults to the window.location.hostname
42
+    2. desktopSharingChromeExtId - The ID of the jidesha extension for Chrome. Example: 'mbocklcggfhnbahlnepmldehdhpjfcjp'
43
+    3. desktopSharingChromeDisabled - Boolean. Whether desktop sharing should be disabled on Chrome. Example: false.
44
+    4. desktopSharingChromeSources - Array of strings with the media sources to use when using screen sharing with the Chrome extension. Example: ['screen', 'window']
45
+    5. desktopSharingChromeMinExtVersion - Required version of Chrome extension. Example: '0.1'
46
+    6. desktopSharingFirefoxExtId - The ID of the jidesha extension for Firefox. If null, we assume that no extension is required.
47
+    7. desktopSharingFirefoxDisabled - Boolean. Whether desktop sharing should be disabled on Firefox. Example: false.
48
+    8. desktopSharingFirefoxMaxVersionExtRequired - The maximum version of Firefox which requires a jidesha extension. Example: if set to 41, we will require the extension for Firefox versions up to and including 41. On Firefox 42 and higher, we will run without the extension. If set to -1, an extension will be required for all versions of Firefox.
49
+    9. desktopSharingFirefoxExtensionURL - The URL to the Firefox extension for desktop sharing. "null" if no extension is required.
50
+    10. disableAudioLevels - boolean property. Enables/disables audio levels.
51
+    11. disableSimulcast - boolean property. Enables/disables simulcast.
52
+    12. enableWindowOnErrorHandler - boolean property (default false). Enables/disables attaching global onerror handler (window.onerror).
53
+    13. disableThirdPartyRequests - if true - callstats will be disabled and the callstats API won't be included.
54
+    14. enableAnalyticsLogging - boolean property (default false). Enables/disables analytics logging.
55
+    15. callStatsCustomScriptUrl - (optional) custom url to access callstats client script
56
+    16. callStatsConfIDNamespace - (optional) a namespace to prepend the callstats conference ID with. Defaults to the window.location.hostname
57 57
 
58 58
 * ```JitsiMeetJS.JitsiConnection``` - the ```JitsiConnection``` constructor. You can use that to create new server connection.
59 59
 

+ 2
- 2
doc/example/example.js View File

@@ -208,10 +208,10 @@ $(window).bind('unload', unload);
208 208
 // JitsiMeetJS.setLogLevel(JitsiMeetJS.logLevels.ERROR);
209 209
 var initOptions = {
210 210
     disableAudioLevels: true,
211
-    // Desktop sharing method. Can be set to 'ext', 'webrtc' or false to disable.
212
-    desktopSharingChromeMethod: 'ext',
213 211
     // The ID of the jidesha extension for Chrome.
214 212
     desktopSharingChromeExtId: 'mbocklcggfhnbahlnepmldehdhpjfcjp',
213
+    // Whether desktop sharing should be disabled on Chrome.
214
+    desktopSharingChromeDisabled: false,
215 215
     // The media sources to use when using screen sharing with the Chrome
216 216
     // extension.
217 217
     desktopSharingChromeSources: ['screen', 'window'],

+ 20
- 38
modules/RTC/ScreenObtainer.js View File

@@ -58,13 +58,6 @@ var ScreenObtainer = {
58 58
      * Initializes the function used to obtain a screen capture
59 59
      * (this.obtainStream).
60 60
      *
61
-     * If the browser is Chrome, it uses the value of
62
-     * 'options.desktopSharingChromeMethod' (or 'options.desktopSharing') to
63
-     * decide whether to use the a Chrome extension (if the value is 'ext'),
64
-     * use the "screen" media source (if the value is 'webrtc'),
65
-     * or disable screen capture (if the value is other).
66
-     * Note that for the "screen" media source to work the
67
-     * 'chrome://flags/#enable-usermedia-screen-capture' flag must be set.
68 61
      * @param options {object}
69 62
      * @param gum {Function} GUM method
70 63
      */
@@ -76,10 +69,6 @@ var ScreenObtainer = {
76 69
         if (RTCBrowserType.isFirefox())
77 70
             initFirefoxExtensionDetection(options);
78 71
 
79
-        // TODO remove this, options.desktopSharing is deprecated.
80
-        var chromeMethod =
81
-            (options.desktopSharingChromeMethod || options.desktopSharing);
82
-
83 72
         if (RTCBrowserType.isNWJS()) {
84 73
             obtainDesktopStream = (options, onSuccess, onFailure) => {
85 74
                 window.JitsiMeetNW.obtainDesktopStream (
@@ -138,18 +127,18 @@ var ScreenObtainer = {
138 127
                 logger.info("Using Temasys plugin for desktop sharing");
139 128
             }
140 129
         } else if (RTCBrowserType.isChrome()) {
141
-            if (chromeMethod == "ext") {
142
-                if (RTCBrowserType.getChromeVersion() >= 34) {
143
-                    obtainDesktopStream =
144
-                        this.obtainScreenFromExtension;
145
-                    logger.info("Using Chrome extension for desktop sharing");
146
-                    initChromeExtension(options);
147
-                } else {
148
-                    logger.info("Chrome extension not supported until ver 34");
149
-                }
150
-            } else if (chromeMethod == "webrtc") {
151
-                obtainDesktopStream = obtainWebRTCScreen;
152
-                logger.info("Using Chrome WebRTC for desktop sharing");
130
+            if (options.desktopSharingChromeDisabled ||
131
+                options.desktopSharingChromeMethod === false ||
132
+                !options.desktopSharingChromeExtId) {
133
+                // TODO: desktopSharingChromeMethod is deprecated, remove.
134
+                obtainDesktopStream = null;
135
+            } else if (RTCBrowserType.getChromeVersion() >= 34) {
136
+                obtainDesktopStream =
137
+                    this.obtainScreenFromExtension;
138
+                logger.info("Using Chrome extension for desktop sharing");
139
+                initChromeExtension(options);
140
+            } else {
141
+                logger.info("Chrome extension not supported until ver 34");
153 142
             }
154 143
         } else if (RTCBrowserType.isFirefox()) {
155 144
             if (options.desktopSharingFirefoxDisabled) {
@@ -331,14 +320,13 @@ function obtainWebRTCScreen(options, streamCallback, failCallback) {
331 320
 /**
332 321
  * Constructs inline install URL for Chrome desktop streaming extension.
333 322
  * The 'chromeExtensionId' must be defined in options parameter.
334
- * @param options supports "desktopSharingChromeExtId" and "chromeExtensionId"
323
+ * @param options supports "desktopSharingChromeExtId"
335 324
  * @returns {string}
336 325
  */
337 326
 function getWebStoreInstallUrl(options)
338 327
 {
339
-    //TODO remove chromeExtensionId (deprecated)
340 328
     return "https://chrome.google.com/webstore/detail/" +
341
-        (options.desktopSharingChromeExtId || options.chromeExtensionId);
329
+        options.desktopSharingChromeExtId;
342 330
 }
343 331
 
344 332
 /**
@@ -387,8 +375,7 @@ function checkChromeExtInstalled(callback, options) {
387 375
         return;
388 376
     }
389 377
     chrome.runtime.sendMessage(
390
-        //TODO: remove chromeExtensionId (deprecated)
391
-        (options.desktopSharingChromeExtId || options.chromeExtensionId),
378
+        options.desktopSharingChromeExtId,
392 379
         { getVersion: true },
393 380
         response => {
394 381
             if (!response || !response.version) {
@@ -401,11 +388,9 @@ function checkChromeExtInstalled(callback, options) {
401 388
             // Check installed extension version
402 389
             var extVersion = response.version;
403 390
             logger.log('Extension version is: ' + extVersion);
404
-            //TODO: remove minChromeExtVersion (deprecated)
405 391
             var updateRequired
406 392
                 = isUpdateRequired(
407
-                    (options.desktopSharingChromeMinExtVersion ||
408
-                        options.minChromeExtVersion),
393
+                    options.desktopSharingChromeMinExtVersion,
409 394
                     extVersion);
410 395
             callback(!updateRequired, updateRequired);
411 396
         }
@@ -416,13 +401,10 @@ function doGetStreamFromExtension(options, streamCallback, failCallback) {
416 401
     // Sends 'getStream' msg to the extension.
417 402
     // Extension id must be defined in the config.
418 403
     chrome.runtime.sendMessage(
419
-        //TODO: remove chromeExtensionId (deprecated)
420
-        (options.desktopSharingChromeExtId || options.chromeExtensionId),
404
+        options.desktopSharingChromeExtId,
421 405
         {
422 406
             getStream: true,
423
-            //TODO: remove desktopSharingSources (deprecated).
424
-            sources: (options.desktopSharingChromeSources ||
425
-                options.desktopSharingSources)
407
+            sources: options.desktopSharingChromeSources
426 408
         },
427 409
         response => {
428 410
             if (!response) {
@@ -445,7 +427,7 @@ function doGetStreamFromExtension(options, streamCallback, failCallback) {
445 427
  * Initializes <link rel=chrome-webstore-item /> with extension id set in
446 428
  * config.js to support inline installs. Host site must be selected as main
447 429
  * website of published extension.
448
- * @param options supports "desktopSharingChromeExtId" and "chromeExtensionId"
430
+ * @param options supports "desktopSharingChromeExtId"
449 431
  */
450 432
 function initInlineInstalls(options)
451 433
 {
@@ -537,7 +519,7 @@ function onGetStreamResponse(response, onSuccess, onFailure) {
537 519
 /**
538 520
  * Starts the detection of an installed jidesha extension for firefox.
539 521
  * @param options supports "desktopSharingFirefoxDisabled",
540
- * "desktopSharingFirefoxExtId" and "chromeExtensionId"
522
+ * "desktopSharingFirefoxExtId"
541 523
  */
542 524
 function initFirefoxExtensionDetection(options) {
543 525
     if (options.desktopSharingFirefoxDisabled) {

Loading…
Cancel
Save