|
|
@@ -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
|
|
|
@@ -327,7 +327,11 @@ function pollForAvailableMediaDevices() {
|
|
327
|
327
|
// and then plug in a new one.
|
|
328
|
328
|
if (rawEnumerateDevicesWithCallback) {
|
|
329
|
329
|
rawEnumerateDevicesWithCallback(function (devices) {
|
|
330
|
|
- if (compareAvailableMediaDevices(devices)) {
|
|
|
330
|
+ // We don't fire RTCEvents.DEVICE_LIST_CHANGED for the first time
|
|
|
331
|
+ // we call enumerateDevices(). This is the initial step.
|
|
|
332
|
+ if (typeof currentlyAvailableMediaDevices === 'undefined') {
|
|
|
333
|
+ currentlyAvailableMediaDevices = devices.slice(0);
|
|
|
334
|
+ } else if (compareAvailableMediaDevices(devices)) {
|
|
331
|
335
|
onMediaDevicesListChanged(devices);
|
|
332
|
336
|
}
|
|
333
|
337
|
|