|
@@ -1552,27 +1552,27 @@ const rtcUtils = new RTCUtils();
|
1552
|
1552
|
|
1553
|
1553
|
/**
|
1554
|
1554
|
*
|
1555
|
|
- * @param options
|
|
1555
|
+ * @param context Execution context, containing options and callbacks
|
1556
|
1556
|
*/
|
1557
|
|
-function obtainDevices(options) {
|
1558
|
|
- if (!options.devices || options.devices.length === 0) {
|
1559
|
|
- return options.successCallback(options.streams || {});
|
|
1557
|
+function obtainDevices(context) {
|
|
1558
|
+ if (!context.devices || context.devices.length === 0) {
|
|
1559
|
+ return context.successCallback(context.streams || {});
|
1560
|
1560
|
}
|
1561
|
1561
|
|
1562
|
|
- const device = options.devices.splice(0, 1);
|
|
1562
|
+ const device = context.devices.splice(0, 1);
|
1563
|
1563
|
|
1564
|
|
- options.deviceGUM[device](options.options)
|
|
1564
|
+ context.deviceGUM[device](context.options)
|
1565
|
1565
|
.then(stream => {
|
1566
|
|
- options.streams = options.streams || {};
|
1567
|
|
- options.streams[device] = stream;
|
1568
|
|
- obtainDevices(options);
|
|
1566
|
+ context.streams = context.streams || {};
|
|
1567
|
+ context.streams[device] = stream;
|
|
1568
|
+ obtainDevices(context);
|
1569
|
1569
|
}, error => {
|
1570
|
|
- Object.keys(options.streams).forEach(
|
1571
|
|
- d => rtcUtils.stopMediaStream(options.streams[d]));
|
|
1570
|
+ Object.keys(context.streams).forEach(
|
|
1571
|
+ d => rtcUtils.stopMediaStream(context.streams[d]));
|
1572
|
1572
|
logger.error(
|
1573
|
1573
|
`failed to obtain ${device} stream - stop`, error);
|
1574
|
1574
|
|
1575
|
|
- options.errorCallback(error);
|
|
1575
|
+ context.errorCallback(error);
|
1576
|
1576
|
});
|
1577
|
1577
|
}
|
1578
|
1578
|
|