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