|
|
@@ -281,30 +281,28 @@ class RTCUtils extends Listenable {
|
|
281
|
281
|
|
|
282
|
282
|
screenObtainer.init(options);
|
|
283
|
283
|
|
|
284
|
|
- if (this.isDeviceListAvailable()) {
|
|
285
|
|
- this.enumerateDevices(ds => {
|
|
286
|
|
- availableDevices = ds.slice(0);
|
|
287
|
|
-
|
|
288
|
|
- logger.debug('Available devices: ', availableDevices);
|
|
289
|
|
- sendDeviceListToAnalytics(availableDevices);
|
|
290
|
|
-
|
|
291
|
|
- this.eventEmitter.emit(
|
|
292
|
|
- RTCEvents.DEVICE_LIST_AVAILABLE,
|
|
293
|
|
- availableDevices);
|
|
294
|
|
-
|
|
295
|
|
- if (browser.supportsDeviceChangeEvent()) {
|
|
296
|
|
- navigator.mediaDevices.addEventListener(
|
|
297
|
|
- 'devicechange',
|
|
298
|
|
- () => this.enumerateDevices(emptyFuncton));
|
|
299
|
|
- } else {
|
|
300
|
|
- // Periodically poll enumerateDevices() method to check if
|
|
301
|
|
- // list of media devices has changed.
|
|
302
|
|
- availableDevicesPollTimer = window.setInterval(
|
|
303
|
|
- () => this.enumerateDevices(emptyFuncton),
|
|
304
|
|
- AVAILABLE_DEVICES_POLL_INTERVAL_TIME);
|
|
305
|
|
- }
|
|
306
|
|
- });
|
|
307
|
|
- }
|
|
|
284
|
+ this.enumerateDevices(ds => {
|
|
|
285
|
+ availableDevices = ds.slice(0);
|
|
|
286
|
+
|
|
|
287
|
+ logger.debug('Available devices: ', availableDevices);
|
|
|
288
|
+ sendDeviceListToAnalytics(availableDevices);
|
|
|
289
|
+
|
|
|
290
|
+ this.eventEmitter.emit(
|
|
|
291
|
+ RTCEvents.DEVICE_LIST_AVAILABLE,
|
|
|
292
|
+ availableDevices);
|
|
|
293
|
+
|
|
|
294
|
+ if (browser.supportsDeviceChangeEvent()) {
|
|
|
295
|
+ navigator.mediaDevices.addEventListener(
|
|
|
296
|
+ 'devicechange',
|
|
|
297
|
+ () => this.enumerateDevices(emptyFuncton));
|
|
|
298
|
+ } else {
|
|
|
299
|
+ // Periodically poll enumerateDevices() method to check if
|
|
|
300
|
+ // list of media devices has changed.
|
|
|
301
|
+ availableDevicesPollTimer = window.setInterval(
|
|
|
302
|
+ () => this.enumerateDevices(emptyFuncton),
|
|
|
303
|
+ AVAILABLE_DEVICES_POLL_INTERVAL_TIME);
|
|
|
304
|
+ }
|
|
|
305
|
+ });
|
|
308
|
306
|
}
|
|
309
|
307
|
|
|
310
|
308
|
/**
|
|
|
@@ -709,18 +707,6 @@ class RTCUtils extends Listenable {
|
|
709
|
707
|
});
|
|
710
|
708
|
}
|
|
711
|
709
|
|
|
712
|
|
- /**
|
|
713
|
|
- * Checks whether it is possible to enumerate available cameras/microphones.
|
|
714
|
|
- *
|
|
715
|
|
- * @returns {boolean} {@code true} if the device listing is available;
|
|
716
|
|
- * {@code false}, otherwise.
|
|
717
|
|
- */
|
|
718
|
|
- isDeviceListAvailable() {
|
|
719
|
|
- return Boolean(
|
|
720
|
|
- navigator.mediaDevices
|
|
721
|
|
- && navigator.mediaDevices.enumerateDevices);
|
|
722
|
|
- }
|
|
723
|
|
-
|
|
724
|
710
|
/**
|
|
725
|
711
|
* Returns true if changing the input (camera / microphone) or output
|
|
726
|
712
|
* (audio) device is supported and false if not.
|