Selaa lähdekoodia

Merge pull request #343 from saghul/ds-options-cleanup

cleanup: Make desktop sharing options consistent and drop deprecated …
dev1
Дамян Минков 8 vuotta sitten
vanhempi
commit
a9277e7bd4
3 muutettua tiedostoa jossa 37 lisäystä ja 55 poistoa
  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 Näytä tiedosto

39
 *  ```JitsiMeetJS.init(options)``` - this method initialized Jitsi Meet API.
39
 *  ```JitsiMeetJS.init(options)``` - this method initialized Jitsi Meet API.
40
 The ```options``` parameter is JS object with the following properties:
40
 The ```options``` parameter is JS object with the following properties:
41
     1. useIPv6 - boolean property
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
 * ```JitsiMeetJS.JitsiConnection``` - the ```JitsiConnection``` constructor. You can use that to create new server connection.
58
 * ```JitsiMeetJS.JitsiConnection``` - the ```JitsiConnection``` constructor. You can use that to create new server connection.
59
 
59
 

+ 2
- 2
doc/example/example.js Näytä tiedosto

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

+ 20
- 38
modules/RTC/ScreenObtainer.js Näytä tiedosto

58
      * Initializes the function used to obtain a screen capture
58
      * Initializes the function used to obtain a screen capture
59
      * (this.obtainStream).
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
      * @param options {object}
61
      * @param options {object}
69
      * @param gum {Function} GUM method
62
      * @param gum {Function} GUM method
70
      */
63
      */
76
         if (RTCBrowserType.isFirefox())
69
         if (RTCBrowserType.isFirefox())
77
             initFirefoxExtensionDetection(options);
70
             initFirefoxExtensionDetection(options);
78
 
71
 
79
-        // TODO remove this, options.desktopSharing is deprecated.
80
-        var chromeMethod =
81
-            (options.desktopSharingChromeMethod || options.desktopSharing);
82
-
83
         if (RTCBrowserType.isNWJS()) {
72
         if (RTCBrowserType.isNWJS()) {
84
             obtainDesktopStream = (options, onSuccess, onFailure) => {
73
             obtainDesktopStream = (options, onSuccess, onFailure) => {
85
                 window.JitsiMeetNW.obtainDesktopStream (
74
                 window.JitsiMeetNW.obtainDesktopStream (
138
                 logger.info("Using Temasys plugin for desktop sharing");
127
                 logger.info("Using Temasys plugin for desktop sharing");
139
             }
128
             }
140
         } else if (RTCBrowserType.isChrome()) {
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
         } else if (RTCBrowserType.isFirefox()) {
143
         } else if (RTCBrowserType.isFirefox()) {
155
             if (options.desktopSharingFirefoxDisabled) {
144
             if (options.desktopSharingFirefoxDisabled) {
331
 /**
320
 /**
332
  * Constructs inline install URL for Chrome desktop streaming extension.
321
  * Constructs inline install URL for Chrome desktop streaming extension.
333
  * The 'chromeExtensionId' must be defined in options parameter.
322
  * The 'chromeExtensionId' must be defined in options parameter.
334
- * @param options supports "desktopSharingChromeExtId" and "chromeExtensionId"
323
+ * @param options supports "desktopSharingChromeExtId"
335
  * @returns {string}
324
  * @returns {string}
336
  */
325
  */
337
 function getWebStoreInstallUrl(options)
326
 function getWebStoreInstallUrl(options)
338
 {
327
 {
339
-    //TODO remove chromeExtensionId (deprecated)
340
     return "https://chrome.google.com/webstore/detail/" +
328
     return "https://chrome.google.com/webstore/detail/" +
341
-        (options.desktopSharingChromeExtId || options.chromeExtensionId);
329
+        options.desktopSharingChromeExtId;
342
 }
330
 }
343
 
331
 
344
 /**
332
 /**
387
         return;
375
         return;
388
     }
376
     }
389
     chrome.runtime.sendMessage(
377
     chrome.runtime.sendMessage(
390
-        //TODO: remove chromeExtensionId (deprecated)
391
-        (options.desktopSharingChromeExtId || options.chromeExtensionId),
378
+        options.desktopSharingChromeExtId,
392
         { getVersion: true },
379
         { getVersion: true },
393
         response => {
380
         response => {
394
             if (!response || !response.version) {
381
             if (!response || !response.version) {
401
             // Check installed extension version
388
             // Check installed extension version
402
             var extVersion = response.version;
389
             var extVersion = response.version;
403
             logger.log('Extension version is: ' + extVersion);
390
             logger.log('Extension version is: ' + extVersion);
404
-            //TODO: remove minChromeExtVersion (deprecated)
405
             var updateRequired
391
             var updateRequired
406
                 = isUpdateRequired(
392
                 = isUpdateRequired(
407
-                    (options.desktopSharingChromeMinExtVersion ||
408
-                        options.minChromeExtVersion),
393
+                    options.desktopSharingChromeMinExtVersion,
409
                     extVersion);
394
                     extVersion);
410
             callback(!updateRequired, updateRequired);
395
             callback(!updateRequired, updateRequired);
411
         }
396
         }
416
     // Sends 'getStream' msg to the extension.
401
     // Sends 'getStream' msg to the extension.
417
     // Extension id must be defined in the config.
402
     // Extension id must be defined in the config.
418
     chrome.runtime.sendMessage(
403
     chrome.runtime.sendMessage(
419
-        //TODO: remove chromeExtensionId (deprecated)
420
-        (options.desktopSharingChromeExtId || options.chromeExtensionId),
404
+        options.desktopSharingChromeExtId,
421
         {
405
         {
422
             getStream: true,
406
             getStream: true,
423
-            //TODO: remove desktopSharingSources (deprecated).
424
-            sources: (options.desktopSharingChromeSources ||
425
-                options.desktopSharingSources)
407
+            sources: options.desktopSharingChromeSources
426
         },
408
         },
427
         response => {
409
         response => {
428
             if (!response) {
410
             if (!response) {
445
  * Initializes <link rel=chrome-webstore-item /> with extension id set in
427
  * Initializes <link rel=chrome-webstore-item /> with extension id set in
446
  * config.js to support inline installs. Host site must be selected as main
428
  * config.js to support inline installs. Host site must be selected as main
447
  * website of published extension.
429
  * website of published extension.
448
- * @param options supports "desktopSharingChromeExtId" and "chromeExtensionId"
430
+ * @param options supports "desktopSharingChromeExtId"
449
  */
431
  */
450
 function initInlineInstalls(options)
432
 function initInlineInstalls(options)
451
 {
433
 {
537
 /**
519
 /**
538
  * Starts the detection of an installed jidesha extension for firefox.
520
  * Starts the detection of an installed jidesha extension for firefox.
539
  * @param options supports "desktopSharingFirefoxDisabled",
521
  * @param options supports "desktopSharingFirefoxDisabled",
540
- * "desktopSharingFirefoxExtId" and "chromeExtensionId"
522
+ * "desktopSharingFirefoxExtId"
541
  */
523
  */
542
 function initFirefoxExtensionDetection(options) {
524
 function initFirefoxExtensionDetection(options) {
543
     if (options.desktopSharingFirefoxDisabled) {
525
     if (options.desktopSharingFirefoxDisabled) {

Loading…
Peruuta
Tallenna