|
|
@@ -40,7 +40,7 @@ var featureDetectionAudioEl = document.createElement('audio');
|
|
40
|
40
|
var isAudioOutputDeviceChangeAvailable =
|
|
41
|
41
|
typeof featureDetectionAudioEl.setSinkId !== 'undefined';
|
|
42
|
42
|
|
|
43
|
|
-var currentlyAvailableMediaDevices = [];
|
|
|
43
|
+var currentlyAvailableMediaDevices;
|
|
44
|
44
|
|
|
45
|
45
|
var rawEnumerateDevicesWithCallback = navigator.mediaDevices
|
|
46
|
46
|
&& navigator.mediaDevices.enumerateDevices
|
|
|
@@ -305,7 +305,11 @@ function pollForAvailableMediaDevices() {
|
|
305
|
305
|
// and then plug in a new one.
|
|
306
|
306
|
if (rawEnumerateDevicesWithCallback) {
|
|
307
|
307
|
rawEnumerateDevicesWithCallback(function (devices) {
|
|
308
|
|
- if (compareAvailableMediaDevices(devices)) {
|
|
|
308
|
+ // We don't fire RTCEvents.DEVICE_LIST_CHANGED for the first time
|
|
|
309
|
+ // we call enumerateDevices(). This is the initial step.
|
|
|
310
|
+ if (typeof currentlyAvailableMediaDevices === 'undefined') {
|
|
|
311
|
+ currentlyAvailableMediaDevices = devices.slice(0);
|
|
|
312
|
+ } else if (compareAvailableMediaDevices(devices)) {
|
|
309
|
313
|
onMediaDevicesListChanged(devices);
|
|
310
|
314
|
}
|
|
311
|
315
|
|