Merge branch 'msedge-webcam-bugfix' into develop
commit
f7bb0ab738
|
|
@ -81,9 +81,9 @@ export default class RoomClient
|
||||||
|
|
||||||
// Map of webcam MediaDeviceInfos indexed by deviceId.
|
// Map of webcam MediaDeviceInfos indexed by deviceId.
|
||||||
// @type {Map<String, MediaDeviceInfos>}
|
// @type {Map<String, MediaDeviceInfos>}
|
||||||
this._webcams = {};
|
this._webcams = new Map();
|
||||||
|
|
||||||
this._audioDevices = {};
|
this._audioDevices = new Map();
|
||||||
|
|
||||||
// Local Webcam. Object with:
|
// Local Webcam. Object with:
|
||||||
// - {MediaDeviceInfo} [device]
|
// - {MediaDeviceInfo} [device]
|
||||||
|
|
@ -386,7 +386,7 @@ export default class RoomClient
|
||||||
return Promise.resolve()
|
return Promise.resolve()
|
||||||
.then(() =>
|
.then(() =>
|
||||||
{
|
{
|
||||||
this._audioDevice.device = this._audioDevices[deviceId];
|
this._audioDevice.device = this._audioDevices.get(deviceId);
|
||||||
|
|
||||||
logger.debug(
|
logger.debug(
|
||||||
'changeAudioDevice() | new selected webcam [device:%o]',
|
'changeAudioDevice() | new selected webcam [device:%o]',
|
||||||
|
|
@ -452,7 +452,7 @@ export default class RoomClient
|
||||||
return Promise.resolve()
|
return Promise.resolve()
|
||||||
.then(() =>
|
.then(() =>
|
||||||
{
|
{
|
||||||
this._webcam.device = this._webcams[deviceId];
|
this._webcam.device = this._webcams.get(deviceId);
|
||||||
|
|
||||||
logger.debug(
|
logger.debug(
|
||||||
'changeWebcam() | new selected webcam [device:%o]',
|
'changeWebcam() | new selected webcam [device:%o]',
|
||||||
|
|
@ -1640,7 +1640,7 @@ export default class RoomClient
|
||||||
logger.debug('_updateAudioDevices()');
|
logger.debug('_updateAudioDevices()');
|
||||||
|
|
||||||
// Reset the list.
|
// Reset the list.
|
||||||
this._audioDevices = {};
|
this._audioDevices = new Map();
|
||||||
|
|
||||||
return Promise.resolve()
|
return Promise.resolve()
|
||||||
.then(() =>
|
.then(() =>
|
||||||
|
|
@ -1656,28 +1656,27 @@ export default class RoomClient
|
||||||
if (device.kind !== 'audioinput')
|
if (device.kind !== 'audioinput')
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
this._audioDevices[device.deviceId] = {
|
device.value = device.deviceId;
|
||||||
value : device.deviceId,
|
|
||||||
label : device.label,
|
this._audioDevices.set(device.deviceId, device);
|
||||||
deviceId : device.deviceId
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.then(() =>
|
.then(() =>
|
||||||
{
|
{
|
||||||
|
const array = Array.from(this._audioDevices.values());
|
||||||
|
const len = array.length;
|
||||||
const currentAudioDeviceId =
|
const currentAudioDeviceId =
|
||||||
this._audioDevice.device ? this._audioDevice.device.deviceId : undefined;
|
this._audioDevice.device ? this._audioDevice.device.deviceId : undefined;
|
||||||
|
|
||||||
logger.debug('_updateAudioDevices() [audiodevices:%o]', this._audioDevices);
|
logger.debug('_updateAudioDevices() [audiodevices:%o]', array);
|
||||||
|
|
||||||
const len = Object.keys(this._audioDevices).length;
|
|
||||||
|
|
||||||
if (len === 0)
|
if (len === 0)
|
||||||
this._audioDevice.device = null;
|
this._audioDevice.device = null;
|
||||||
else if (!this._audioDevices[currentAudioDeviceId])
|
else if (!this._audioDevices.has(currentAudioDeviceId))
|
||||||
for (this._audioDevice.device in this._audioDevices)
|
this._audioDevice.device = array[0];
|
||||||
if (this._audioDevices.hasOwnProperty(this._audioDevice.device))
|
|
||||||
break;
|
this._dispatch(
|
||||||
|
stateActions.setCanChangeWebcam(this._webcams.size >= 2));
|
||||||
|
|
||||||
this._dispatch(
|
this._dispatch(
|
||||||
stateActions.setCanChangeAudioDevice(len >= 2));
|
stateActions.setCanChangeAudioDevice(len >= 2));
|
||||||
|
|
@ -1692,7 +1691,7 @@ export default class RoomClient
|
||||||
logger.debug('_updateWebcams()');
|
logger.debug('_updateWebcams()');
|
||||||
|
|
||||||
// Reset the list.
|
// Reset the list.
|
||||||
this._webcams = {};
|
this._webcams = new Map();
|
||||||
|
|
||||||
return Promise.resolve()
|
return Promise.resolve()
|
||||||
.then(() =>
|
.then(() =>
|
||||||
|
|
@ -1708,28 +1707,27 @@ export default class RoomClient
|
||||||
if (device.kind !== 'videoinput')
|
if (device.kind !== 'videoinput')
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
this._webcams[device.deviceId] = {
|
device.value = device.deviceId;
|
||||||
value : device.deviceId,
|
|
||||||
label : device.label,
|
this._webcams.set(device.deviceId, device);
|
||||||
deviceId : device.deviceId
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.then(() =>
|
.then(() =>
|
||||||
{
|
{
|
||||||
|
const array = Array.from(this._webcams.values());
|
||||||
|
const len = array.length;
|
||||||
const currentWebcamId =
|
const currentWebcamId =
|
||||||
this._webcam.device ? this._webcam.device.deviceId : undefined;
|
this._webcam.device ? this._webcam.device.deviceId : undefined;
|
||||||
|
|
||||||
logger.debug('_updateWebcams() [webcams:%o]', this._webcams);
|
logger.debug('_updateWebcams() [webcams:%o]', array);
|
||||||
|
|
||||||
const len = Object.keys(this._webcams).length;
|
|
||||||
|
|
||||||
if (len === 0)
|
if (len === 0)
|
||||||
this._webcam.device = null;
|
this._webcam.device = null;
|
||||||
else if (!this._webcams[currentWebcamId])
|
else if (!this._webcams.has(currentWebcamId))
|
||||||
for (this._webcam.device in this._webcams)
|
this._webcam.device = array[0];
|
||||||
if (this._webcams.hasOwnProperty(this._webcam.device))
|
|
||||||
break;
|
this._dispatch(
|
||||||
|
stateActions.setCanChangeWebcam(this._webcams.size >= 2));
|
||||||
|
|
||||||
this._dispatch(
|
this._dispatch(
|
||||||
stateActions.setCanChangeWebcam(len >= 2));
|
stateActions.setCanChangeWebcam(len >= 2));
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ class Settings extends React.Component
|
||||||
webcamText = 'Unable to select camera';
|
webcamText = 'Unable to select camera';
|
||||||
|
|
||||||
if (me.webcamDevices)
|
if (me.webcamDevices)
|
||||||
webcams = Object.values(me.webcamDevices);
|
webcams = Array.from(me.webcamDevices.values());
|
||||||
else
|
else
|
||||||
webcams = [];
|
webcams = [];
|
||||||
|
|
||||||
|
|
@ -45,7 +45,7 @@ class Settings extends React.Component
|
||||||
audioDevicesText = 'Unable to select audio input device';
|
audioDevicesText = 'Unable to select audio input device';
|
||||||
|
|
||||||
if (me.audioDevices)
|
if (me.audioDevices)
|
||||||
audioDevices = Object.values(me.audioDevices);
|
audioDevices = Array.from(me.audioDevices.values());
|
||||||
else
|
else
|
||||||
audioDevices = [];
|
audioDevices = [];
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue