Skip to content

Commit

Permalink
ref(RTC): Distinguish data by using different names.
Browse files Browse the repository at this point in the history
  • Loading branch information
guusdk committed Nov 30, 2018
1 parent 258cd18 commit cd1a89c
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions modules/RTC/RTCUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -1552,27 +1552,27 @@ const rtcUtils = new RTCUtils();

/**
*
* @param options
* @param context Execution context, containing options and callbacks
*/
function obtainDevices(options) {
if (!options.devices || options.devices.length === 0) {
return options.successCallback(options.streams || {});
function obtainDevices(context) {
if (!context.devices || context.devices.length === 0) {
return context.successCallback(context.streams || {});
}

const device = options.devices.splice(0, 1);
const device = context.devices.splice(0, 1);

options.deviceGUM[device](options.options)
context.deviceGUM[device](context.options)
.then(stream => {
options.streams = options.streams || {};
options.streams[device] = stream;
obtainDevices(options);
context.streams = context.streams || {};
context.streams[device] = stream;
obtainDevices(context);
}, error => {
Object.keys(options.streams).forEach(
d => rtcUtils.stopMediaStream(options.streams[d]));
Object.keys(context.streams).forEach(
d => rtcUtils.stopMediaStream(context.streams[d]));
logger.error(
`failed to obtain ${device} stream - stop`, error);

options.errorCallback(error);
context.errorCallback(error);
});
}

Expand Down

0 comments on commit cd1a89c

Please sign in to comment.