Throws an error if one of the requested local tracks can't be delivered
This commit is contained in:
parent
c198400be9
commit
2dc3cfbd2b
|
@ -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));
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -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));
|
||||
|
|
Loading…
Reference in New Issue