forked from Toumassa/lib-jitsi-meet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
JitsiTrackErrors.js
49 lines (48 loc) · 2.02 KB
/
JitsiTrackErrors.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
var logger = require("jitsi-meet-logger").getLogger(__filename);
module.exports = {
/**
* Returns JitsiTrackErrors based on the error object passed by GUM
* @param error the error
* @param {Array} devices Array with the requested devices
*/
parseError: function (error, devices) {
if (typeof error === "object") {
var constraintName = error.constraintName;
var name;
if (constraintName
&& (name = error.name)
&& (name == "ConstraintNotSatisfiedError"
|| name == "OverconstrainedError")
&& (constraintName == "minWidth"
|| constraintName == "maxWidth"
|| constraintName == "minHeight"
|| constraintName == "maxHeight"
|| constraintName == "width"
|| constraintName == "height")
&& (devices || []).indexOf("video") !== -1) {
return this.UNSUPPORTED_RESOLUTION;
}
if (error.type === "jitsiError") {
return error.errorObject;
}
}
// XXX We're about to lose the details represented by error and devices
// (because we're about to generalize them to GENERAL). At the very
// least log the details.
logger.error('Parsing error into ' + this.GENERAL + ': ' + error);
return this.GENERAL;
},
UNSUPPORTED_RESOLUTION: "gum.unsupported_resolution",
/**
* An event which indicates that the jidesha extension for Firefox is
* needed to proceed with screen sharing, and that it is not installed.
*/
FIREFOX_EXTENSION_NEEDED: "gum.firefox_extension_needed",
CHROME_EXTENSION_INSTALLATION_ERROR:
"gum.chrome_extension_installation_error",
CHROME_EXTENSION_USER_CANCELED:
"gum.chrome_extension_user_canceled",
GENERAL: "gum.general",
TRACK_IS_DISPOSED: "track.track_is_disposed",
TRACK_MUTE_UNMUTE_IN_PROGRESS: "track.mute_unmute_inprogress"
};