From 653f70699559816f9066ddfa91c313db751c1321 Mon Sep 17 00:00:00 2001 From: hristoterezov Date: Wed, 20 Jan 2016 15:06:01 -0600 Subject: [PATCH] Adds 'firefox extention needed' error --- JitsiTrackErrors.js | 3 +++ modules/RTC/RTCUtils.js | 2 +- modules/RTC/ScreenObtainer.js | 18 ++++-------------- 3 files changed, 8 insertions(+), 15 deletions(-) diff --git a/JitsiTrackErrors.js b/JitsiTrackErrors.js index 1f7e3c301..281a73916 100644 --- a/JitsiTrackErrors.js +++ b/JitsiTrackErrors.js @@ -15,10 +15,13 @@ module.exports = { error.constraintName == "maxHeight") && devices.indexOf("video") !== -1) { return this.UNSUPPORTED_RESOLUTION; + } else if(typeof error === "object" && error.type === "jitsiError") { + return error.object; } else { return this.GENERAL; } }, UNSUPPORTED_RESOLUTION: "gum.unsupported_resolution", + FIREFOX_EXTENSION_NEEDED: "gum.firefox_extension_needed", GENERAL: "gum.general" }; diff --git a/modules/RTC/RTCUtils.js b/modules/RTC/RTCUtils.js index 13252e72b..aeb0a1fcf 100644 --- a/modules/RTC/RTCUtils.js +++ b/modules/RTC/RTCUtils.js @@ -201,7 +201,7 @@ function setAvailableDevices(um, available) { function onReady (options, GUM) { rtcReady = true; eventEmitter.emit(RTCEvents.RTC_READY, true); - screenObtainer.init(eventEmitter, options, GUM); + screenObtainer.init(options, GUM); } /** diff --git a/modules/RTC/ScreenObtainer.js b/modules/RTC/ScreenObtainer.js index d7c2a7609..bfd972531 100644 --- a/modules/RTC/ScreenObtainer.js +++ b/modules/RTC/ScreenObtainer.js @@ -5,6 +5,7 @@ var RTCBrowserType = require("./RTCBrowserType"); var AdapterJS = require("./adapter.screenshare"); var DesktopSharingEventTypes = require("../../service/desktopsharing/DesktopSharingEventTypes"); +var JitsiTrackErrors = require("../../JitsiTrackErrors"); /** * Indicates whether the Chrome desktop sharing extension is installed. @@ -39,16 +40,11 @@ var GUM = null; * Handles obtaining a stream from a screen capture on different browsers. */ var ScreenObtainer = { - /** - * The EventEmitter to use to emit events. - * @type {null} - */ - eventEmitter: null, obtainStream: null, /** * Initializes the function used to obtain a screen capture * (this.obtainStream). - * + * * If the browser is Chrome, it uses the value of * 'options.desktopSharingChromeMethod' (or 'options.desktopSharing') to * decide whether to use the a Chrome extension (if the value is 'ext'), @@ -57,8 +53,7 @@ var ScreenObtainer = { * Note that for the "screen" media source to work the * 'chrome://flags/#enable-usermedia-screen-capture' flag must be set. */ - init: function(eventEmitter, options, gum) { - this.eventEmitter = eventEmitter; + init: function(options, gum) { var obtainDesktopStream = null; this.options = options = options || {}; GUM = gum; @@ -174,14 +169,9 @@ var ScreenObtainer = { firefoxExtInstalled = null; reDetectFirefoxExtension = true; - // Prompt the user to install the extension - this.eventEmitter.emit( - DesktopSharingEventTypes.FIREFOX_EXTENSION_NEEDED, - this.options.desktopSharingFirefoxExtensionURL); - // Make sure desktopsharing knows that we failed, so that it doesn't get // stuck in 'switching' mode. - errorCallback('Firefox extension required.'); + errorCallback(JitsiTrackErrors.FIREFOX_EXTENSION_NEEDED); }, /** * Asks Chrome extension to call chooseDesktopMedia and gets chrome