Переглянути джерело

Adds 'firefox extention needed' error

tags/v0.0.2
hristoterezov 9 роки тому
джерело
коміт
8f45de7635
3 змінених файлів з 8 додано та 15 видалено
  1. 3
    0
      JitsiTrackErrors.js
  2. 1
    1
      modules/RTC/RTCUtils.js
  3. 4
    14
      modules/RTC/ScreenObtainer.js

+ 3
- 0
JitsiTrackErrors.js Переглянути файл

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

+ 1
- 1
modules/RTC/RTCUtils.js Переглянути файл

@@ -201,7 +201,7 @@ function setAvailableDevices(um, available) {
201 201
 function onReady (options, GUM) {
202 202
     rtcReady = true;
203 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 Переглянути файл

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

Завантаження…
Відмінити
Зберегти