Procházet zdrojové kódy

Adds 'firefox extention needed' error

tags/v0.0.2
hristoterezov před 9 roky
rodič
revize
8f45de7635
3 změnil soubory, kde provedl 8 přidání a 15 odebrání
  1. 3
    0
      JitsiTrackErrors.js
  2. 1
    1
      modules/RTC/RTCUtils.js
  3. 4
    14
      modules/RTC/ScreenObtainer.js

+ 3
- 0
JitsiTrackErrors.js Zobrazit soubor

15
             error.constraintName == "maxHeight") &&
15
             error.constraintName == "maxHeight") &&
16
             devices.indexOf("video") !== -1) {
16
             devices.indexOf("video") !== -1) {
17
                 return this.UNSUPPORTED_RESOLUTION;
17
                 return this.UNSUPPORTED_RESOLUTION;
18
+        } else if(typeof error === "object" && error.type === "jitsiError") {
19
+            return error.object;
18
         } else {
20
         } else {
19
             return this.GENERAL;
21
             return this.GENERAL;
20
         }
22
         }
21
     },
23
     },
22
     UNSUPPORTED_RESOLUTION: "gum.unsupported_resolution",
24
     UNSUPPORTED_RESOLUTION: "gum.unsupported_resolution",
25
+    FIREFOX_EXTENSION_NEEDED: "gum.firefox_extension_needed",
23
     GENERAL: "gum.general"
26
     GENERAL: "gum.general"
24
 };
27
 };

+ 1
- 1
modules/RTC/RTCUtils.js Zobrazit soubor

201
 function onReady (options, GUM) {
201
 function onReady (options, GUM) {
202
     rtcReady = true;
202
     rtcReady = true;
203
     eventEmitter.emit(RTCEvents.RTC_READY, true);
203
     eventEmitter.emit(RTCEvents.RTC_READY, true);
204
-    screenObtainer.init(eventEmitter, options, GUM);
204
+    screenObtainer.init(options, GUM);
205
 }
205
 }
206
 
206
 
207
 /**
207
 /**

+ 4
- 14
modules/RTC/ScreenObtainer.js Zobrazit soubor

5
 var AdapterJS = require("./adapter.screenshare");
5
 var AdapterJS = require("./adapter.screenshare");
6
 var DesktopSharingEventTypes
6
 var DesktopSharingEventTypes
7
     = require("../../service/desktopsharing/DesktopSharingEventTypes");
7
     = require("../../service/desktopsharing/DesktopSharingEventTypes");
8
+var JitsiTrackErrors = require("../../JitsiTrackErrors");
8
 
9
 
9
 /**
10
 /**
10
  * Indicates whether the Chrome desktop sharing extension is installed.
11
  * Indicates whether the Chrome desktop sharing extension is installed.
39
  * Handles obtaining a stream from a screen capture on different browsers.
40
  * Handles obtaining a stream from a screen capture on different browsers.
40
  */
41
  */
41
 var ScreenObtainer = {
42
 var ScreenObtainer = {
42
-    /**
43
-     * The EventEmitter to use to emit events.
44
-     * @type {null}
45
-     */
46
-    eventEmitter: null,
47
     obtainStream: null,
43
     obtainStream: null,
48
     /**
44
     /**
49
      * Initializes the function used to obtain a screen capture
45
      * Initializes the function used to obtain a screen capture
50
      * (this.obtainStream).
46
      * (this.obtainStream).
51
-     * 
47
+     *
52
      * If the browser is Chrome, it uses the value of
48
      * If the browser is Chrome, it uses the value of
53
      * 'options.desktopSharingChromeMethod' (or 'options.desktopSharing') to
49
      * 'options.desktopSharingChromeMethod' (or 'options.desktopSharing') to
54
      * decide whether to use the a Chrome extension (if the value is 'ext'),
50
      * decide whether to use the a Chrome extension (if the value is 'ext'),
57
      * Note that for the "screen" media source to work the
53
      * Note that for the "screen" media source to work the
58
      * 'chrome://flags/#enable-usermedia-screen-capture' flag must be set.
54
      * 'chrome://flags/#enable-usermedia-screen-capture' flag must be set.
59
      */
55
      */
60
-    init: function(eventEmitter, options, gum) {
61
-        this.eventEmitter = eventEmitter;
56
+    init: function(options, gum) {
62
         var obtainDesktopStream = null;
57
         var obtainDesktopStream = null;
63
         this.options = options = options || {};
58
         this.options = options = options || {};
64
         GUM = gum;
59
         GUM = gum;
174
         firefoxExtInstalled = null;
169
         firefoxExtInstalled = null;
175
         reDetectFirefoxExtension = true;
170
         reDetectFirefoxExtension = true;
176
 
171
 
177
-        // Prompt the user to install the extension
178
-        this.eventEmitter.emit(
179
-            DesktopSharingEventTypes.FIREFOX_EXTENSION_NEEDED,
180
-            this.options.desktopSharingFirefoxExtensionURL);
181
-
182
         // Make sure desktopsharing knows that we failed, so that it doesn't get
172
         // Make sure desktopsharing knows that we failed, so that it doesn't get
183
         // stuck in 'switching' mode.
173
         // stuck in 'switching' mode.
184
-        errorCallback('Firefox extension required.');
174
+        errorCallback(JitsiTrackErrors.FIREFOX_EXTENSION_NEEDED);
185
     },
175
     },
186
     /**
176
     /**
187
      * Asks Chrome extension to call chooseDesktopMedia and gets chrome
177
      * Asks Chrome extension to call chooseDesktopMedia and gets chrome

Načítá se…
Zrušit
Uložit