|
@@ -136,6 +136,8 @@ export default class JitsiLocalTrack extends JitsiTrack {
|
136
|
136
|
// created (until getConstraints() support), however we can associate
|
137
|
137
|
// tracks with real devices obtained from enumerateDevices() call as
|
138
|
138
|
// soon as it's called.
|
|
139
|
+ // NOTE: this.deviceId corresponds to the device id specified in GUM constraints and this._realDeviceId seems to
|
|
140
|
+ // correspond to the id of a matching device from the available device list.
|
139
|
141
|
this._realDeviceId = this.deviceId === '' ? undefined : this.deviceId;
|
140
|
142
|
|
141
|
143
|
/**
|
|
@@ -169,9 +171,7 @@ export default class JitsiLocalTrack extends JitsiTrack {
|
169
|
171
|
this._onAudioOutputDeviceChanged);
|
170
|
172
|
}
|
171
|
173
|
|
172
|
|
- RTCUtils.addListener(
|
173
|
|
- RTCEvents.DEVICE_LIST_CHANGED,
|
174
|
|
- this._onDeviceListChanged);
|
|
174
|
+ RTCUtils.addListener(RTCEvents.DEVICE_LIST_WILL_CHANGE, this._onDeviceListChanged);
|
175
|
175
|
|
176
|
176
|
this._initNoDataFromSourceHandlers();
|
177
|
177
|
}
|
|
@@ -265,8 +265,14 @@ export default class JitsiLocalTrack extends JitsiTrack {
|
265
|
265
|
*/
|
266
|
266
|
_setRealDeviceIdFromDeviceList(devices) {
|
267
|
267
|
const track = this.getTrack();
|
268
|
|
- const device = devices.find(
|
269
|
|
- d => d.kind === `${track.kind}input` && d.label === track.label);
|
|
268
|
+ const kind = `${track.kind}input`;
|
|
269
|
+ let device = devices.find(d => d.kind === kind && d.label === track.label);
|
|
270
|
+
|
|
271
|
+ if (!device && this._realDeviceId === 'default') { // the default device has been changed.
|
|
272
|
+ const label = (track.label || '').replace('Default - ', '');
|
|
273
|
+
|
|
274
|
+ device = devices.find(d => d.kind === kind && d.label === label);
|
|
275
|
+ }
|
270
|
276
|
|
271
|
277
|
if (device) {
|
272
|
278
|
this._realDeviceId = device.deviceId;
|
|
@@ -519,8 +525,7 @@ export default class JitsiLocalTrack extends JitsiTrack {
|
519
|
525
|
this.detach();
|
520
|
526
|
}
|
521
|
527
|
|
522
|
|
- RTCUtils.removeListener(RTCEvents.DEVICE_LIST_CHANGED,
|
523
|
|
- this._onDeviceListChanged);
|
|
528
|
+ RTCUtils.removeListener(RTCEvents.DEVICE_LIST_WILL_CHANGE, this._onDeviceListChanged);
|
524
|
529
|
|
525
|
530
|
if (this._onAudioOutputDeviceChanged) {
|
526
|
531
|
RTCUtils.removeListener(RTCEvents.AUDIO_OUTPUT_DEVICE_CHANGED,
|