Throws an error if one of the requested local tracks can't be delivered

This commit is contained in:
hristoterezov 2016-01-11 16:52:15 -06:00
parent c198400be9
commit 2dc3cfbd2b
3 changed files with 43 additions and 11 deletions

View File

@ -2893,6 +2893,9 @@ function obtainDevices(options) {
obtainDevices(options);
},
function (error) {
Object.keys(options.streams).forEach(function(device) {
RTCUtils.stopMediaStream(options.streams[device]);
});
logger.error(
"failed to obtain " + device + " stream - stop", error);
options.errorCallback(JitsiTrackErrors.parseError(error, devices));
@ -3249,12 +3252,25 @@ var RTCUtils = {
this.getUserMediaWithConstraints(
options.devices,
function (stream) {
if((options.devices.indexOf("audio") !== -1 &&
!stream.getAudioTracks().length) ||
(options.devices.indexOf("video") !== -1 &&
!stream.getVideoTracks().length))
{
self.stopMediaStream(stream);
reject(JitsiTrackErrors.parseError(
new Error("Unable to get the audio and " +
"video tracks."),
options.devices));
return;
}
if(hasDesktop) {
screenObtainer.obtainStream(
function (desktopStream) {
successCallback({audioVideo: stream,
desktopStream: desktopStream});
}, function (error) {
self.stopMediaStream(stream);
reject(
JitsiTrackErrors.parseError(error,
options.devices));

22
lib-jitsi-meet.min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -343,6 +343,9 @@ function obtainDevices(options) {
obtainDevices(options);
},
function (error) {
Object.keys(options.streams).forEach(function(device) {
RTCUtils.stopMediaStream(options.streams[device]);
});
logger.error(
"failed to obtain " + device + " stream - stop", error);
options.errorCallback(JitsiTrackErrors.parseError(error, devices));
@ -699,12 +702,25 @@ var RTCUtils = {
this.getUserMediaWithConstraints(
options.devices,
function (stream) {
if((options.devices.indexOf("audio") !== -1 &&
!stream.getAudioTracks().length) ||
(options.devices.indexOf("video") !== -1 &&
!stream.getVideoTracks().length))
{
self.stopMediaStream(stream);
reject(JitsiTrackErrors.parseError(
new Error("Unable to get the audio and " +
"video tracks."),
options.devices));
return;
}
if(hasDesktop) {
screenObtainer.obtainStream(
function (desktopStream) {
successCallback({audioVideo: stream,
desktopStream: desktopStream});
}, function (error) {
self.stopMediaStream(stream);
reject(
JitsiTrackErrors.parseError(error,
options.devices));