Merge remote-tracking branch 'origin/lib-jitsi-meet' into lib-jitsi-meet
This commit is contained in:
commit
50550a364e
|
@ -8,6 +8,23 @@ var JitsiTrackErrors = require("./JitsiTrackErrors");
|
|||
var Logger = require("jitsi-meet-logger");
|
||||
var RTC = require("./modules/RTC/RTC");
|
||||
var Statistics = require("./modules/statistics/statistics");
|
||||
var Resolutions = require("./service/RTC/Resolutions");
|
||||
|
||||
function getLowerResolution(resolution) {
|
||||
if(!Resolutions[resolution])
|
||||
return null;
|
||||
var order = Resolutions[resolution].order;
|
||||
var res = null;
|
||||
var resName = null;
|
||||
for(var i in Resolutions) {
|
||||
var tmp = Resolutions[i];
|
||||
if (!res || (res.order < tmp.order && tmp.order < order)) {
|
||||
resName = i;
|
||||
res = tmp;
|
||||
}
|
||||
}
|
||||
return resName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Namespace for the interface of Jitsi Meet Library.
|
||||
|
@ -72,6 +89,16 @@ var LibJitsiMeet = {
|
|||
}
|
||||
}
|
||||
return tracks;
|
||||
}).catch(function (error) {
|
||||
if(error === JitsiTrackErrors.UNSUPPORTED_RESOLUTION) {
|
||||
var oldResolution = options.resolution || '360';
|
||||
var newResolution = getLowerResolution(oldResolution);
|
||||
if(newResolution === null)
|
||||
return Promise.reject(error);
|
||||
options.resolution = newResolution;
|
||||
return LibJitsiMeet.createLocalTracks(options);
|
||||
}
|
||||
return Promise.reject(error);
|
||||
});
|
||||
},
|
||||
/**
|
||||
|
|
|
@ -2,10 +2,10 @@ module.exports = {
|
|||
/**
|
||||
* Returns JitsiTrackErrors based on the error object passed by GUM
|
||||
* @param error the error
|
||||
* @param {Object} options the options object given to GUM.
|
||||
* @param {Array} devices Array with the requested devices
|
||||
*/
|
||||
parseError: function (error, options) {
|
||||
options = options || {};
|
||||
parseError: function (error, devices) {
|
||||
devices = devices || [];
|
||||
if (typeof error == "object" && error.constraintName && error.name
|
||||
&& (error.name == "ConstraintNotSatisfiedError" ||
|
||||
error.name == "OverconstrainedError") &&
|
||||
|
@ -13,7 +13,7 @@ module.exports = {
|
|||
error.constraintName == "maxWidth" ||
|
||||
error.constraintName == "minHeight" ||
|
||||
error.constraintName == "maxHeight") &&
|
||||
options.devices.indexOf("video") !== -1) {
|
||||
devices.indexOf("video") !== -1) {
|
||||
return this.UNSUPPORTED_RESOLUTION;
|
||||
} else {
|
||||
return this.GENERAL;
|
||||
|
|
|
@ -1071,6 +1071,23 @@ var JitsiTrackErrors = require("./JitsiTrackErrors");
|
|||
var Logger = require("jitsi-meet-logger");
|
||||
var RTC = require("./modules/RTC/RTC");
|
||||
var Statistics = require("./modules/statistics/statistics");
|
||||
var Resolutions = require("./service/RTC/Resolutions");
|
||||
|
||||
function getLowerResolution(resolution) {
|
||||
if(!Resolutions[resolution])
|
||||
return null;
|
||||
var order = Resolutions[resolution].order;
|
||||
var res = null;
|
||||
var resName = null;
|
||||
for(var i in Resolutions) {
|
||||
var tmp = Resolutions[i];
|
||||
if (!res || (res.order < tmp.order && tmp.order < order)) {
|
||||
resName = i;
|
||||
res = tmp;
|
||||
}
|
||||
}
|
||||
return resName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Namespace for the interface of Jitsi Meet Library.
|
||||
|
@ -1135,6 +1152,16 @@ var LibJitsiMeet = {
|
|||
}
|
||||
}
|
||||
return tracks;
|
||||
}).catch(function (error) {
|
||||
if(error === JitsiTrackErrors.UNSUPPORTED_RESOLUTION) {
|
||||
var oldResolution = options.resolution || '360';
|
||||
var newResolution = getLowerResolution(oldResolution);
|
||||
if(newResolution === null)
|
||||
return Promise.reject(error);
|
||||
options.resolution = newResolution;
|
||||
return LibJitsiMeet.createLocalTracks(options);
|
||||
}
|
||||
return Promise.reject(error);
|
||||
});
|
||||
},
|
||||
/**
|
||||
|
@ -1163,7 +1190,7 @@ window.Promise = window.Promise || require("es6-promise").Promise;
|
|||
|
||||
module.exports = LibJitsiMeet;
|
||||
|
||||
},{"./JitsiConferenceErrors":2,"./JitsiConferenceEvents":3,"./JitsiConnection":4,"./JitsiConnectionErrors":5,"./JitsiConnectionEvents":6,"./JitsiTrackErrors":9,"./JitsiTrackEvents":10,"./modules/RTC/RTC":16,"./modules/statistics/statistics":24,"es6-promise":46,"jitsi-meet-logger":48}],8:[function(require,module,exports){
|
||||
},{"./JitsiConferenceErrors":2,"./JitsiConferenceEvents":3,"./JitsiConnection":4,"./JitsiConnectionErrors":5,"./JitsiConnectionEvents":6,"./JitsiTrackErrors":9,"./JitsiTrackEvents":10,"./modules/RTC/RTC":16,"./modules/statistics/statistics":24,"./service/RTC/Resolutions":81,"es6-promise":46,"jitsi-meet-logger":48}],8:[function(require,module,exports){
|
||||
/* global Strophe */
|
||||
|
||||
/**
|
||||
|
@ -1326,10 +1353,10 @@ module.exports = {
|
|||
/**
|
||||
* Returns JitsiTrackErrors based on the error object passed by GUM
|
||||
* @param error the error
|
||||
* @param {Object} options the options object given to GUM.
|
||||
* @param {Array} devices Array with the requested devices
|
||||
*/
|
||||
parseError: function (error, options) {
|
||||
options = options || {};
|
||||
parseError: function (error, devices) {
|
||||
devices = devices || [];
|
||||
if (typeof error == "object" && error.constraintName && error.name
|
||||
&& (error.name == "ConstraintNotSatisfiedError" ||
|
||||
error.name == "OverconstrainedError") &&
|
||||
|
@ -1337,7 +1364,7 @@ module.exports = {
|
|||
error.constraintName == "maxWidth" ||
|
||||
error.constraintName == "minHeight" ||
|
||||
error.constraintName == "maxHeight") &&
|
||||
options.devices.indexOf("video") !== -1) {
|
||||
devices.indexOf("video") !== -1) {
|
||||
return this.UNSUPPORTED_RESOLUTION;
|
||||
} else {
|
||||
return this.GENERAL;
|
||||
|
@ -2857,6 +2884,8 @@ function obtainDevices(options) {
|
|||
}
|
||||
|
||||
var device = options.devices.splice(0, 1);
|
||||
var devices = [];
|
||||
devices.push(device);
|
||||
options.deviceGUM[device](function (stream) {
|
||||
options.streams = options.streams || {};
|
||||
options.streams[device] = stream;
|
||||
|
@ -2865,7 +2894,7 @@ function obtainDevices(options) {
|
|||
function (error) {
|
||||
logger.error(
|
||||
"failed to obtain " + device + " stream - stop", error);
|
||||
options.errorCallback(JitsiTrackErrors.parseError(error));
|
||||
options.errorCallback(JitsiTrackErrors.parseError(error, devices));
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -3213,14 +3242,16 @@ var RTCUtils = {
|
|||
desktopStream: desktopStream});
|
||||
}, function (error) {
|
||||
reject(
|
||||
JitsiTrackErrors.parseError(error));
|
||||
JitsiTrackErrors.parseError(error,
|
||||
options.devices));
|
||||
});
|
||||
} else {
|
||||
successCallback({audioVideo: stream});
|
||||
}
|
||||
},
|
||||
function (error) {
|
||||
reject(JitsiTrackErrors.parseError(error));
|
||||
reject(JitsiTrackErrors.parseError(error,
|
||||
options.devices));
|
||||
},
|
||||
options);
|
||||
} else if (hasDesktop) {
|
||||
|
@ -3229,7 +3260,8 @@ var RTCUtils = {
|
|||
successCallback({desktopStream: stream});
|
||||
}, function (error) {
|
||||
reject(
|
||||
JitsiTrackErrors.parseError(error));
|
||||
JitsiTrackErrors.parseError(error,
|
||||
["desktop"]));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -335,6 +335,8 @@ function obtainDevices(options) {
|
|||
}
|
||||
|
||||
var device = options.devices.splice(0, 1);
|
||||
var devices = [];
|
||||
devices.push(device);
|
||||
options.deviceGUM[device](function (stream) {
|
||||
options.streams = options.streams || {};
|
||||
options.streams[device] = stream;
|
||||
|
@ -343,7 +345,7 @@ function obtainDevices(options) {
|
|||
function (error) {
|
||||
logger.error(
|
||||
"failed to obtain " + device + " stream - stop", error);
|
||||
options.errorCallback(JitsiTrackErrors.parseError(error));
|
||||
options.errorCallback(JitsiTrackErrors.parseError(error, devices));
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -691,14 +693,16 @@ var RTCUtils = {
|
|||
desktopStream: desktopStream});
|
||||
}, function (error) {
|
||||
reject(
|
||||
JitsiTrackErrors.parseError(error));
|
||||
JitsiTrackErrors.parseError(error,
|
||||
options.devices));
|
||||
});
|
||||
} else {
|
||||
successCallback({audioVideo: stream});
|
||||
}
|
||||
},
|
||||
function (error) {
|
||||
reject(JitsiTrackErrors.parseError(error));
|
||||
reject(JitsiTrackErrors.parseError(error,
|
||||
options.devices));
|
||||
},
|
||||
options);
|
||||
} else if (hasDesktop) {
|
||||
|
@ -707,7 +711,8 @@ var RTCUtils = {
|
|||
successCallback({desktopStream: stream});
|
||||
}, function (error) {
|
||||
reject(
|
||||
JitsiTrackErrors.parseError(error));
|
||||
JitsiTrackErrors.parseError(error,
|
||||
["desktop"]));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue