Merge pull request #1784 from bbaldino/device_list_available_fix
fix an error when testing a result from a method that returns a promise
This commit is contained in:
commit
4eef52b84e
|
@ -1977,35 +1977,42 @@ export default {
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
_initDeviceList() {
|
_initDeviceList() {
|
||||||
if (JitsiMeetJS.mediaDevices.isDeviceListAvailable() &&
|
JitsiMeetJS.mediaDevices.isDeviceListAvailable()
|
||||||
JitsiMeetJS.mediaDevices.isDeviceChangeAvailable()) {
|
.then(isDeviceListAvailable => {
|
||||||
JitsiMeetJS.mediaDevices.enumerateDevices(devices => {
|
if (isDeviceListAvailable
|
||||||
// Ugly way to synchronize real device IDs with local
|
&& JitsiMeetJS.mediaDevices.isDeviceChangeAvailable()) {
|
||||||
// storage and settings menu. This is a workaround until
|
JitsiMeetJS.mediaDevices.enumerateDevices(devices => {
|
||||||
// getConstraints() method will be implemented in browsers.
|
// Ugly way to synchronize real device IDs with local
|
||||||
if (localAudio) {
|
// storage and settings menu. This is a workaround until
|
||||||
APP.settings.setMicDeviceId(
|
// getConstraints() method will be implemented
|
||||||
localAudio.getDeviceId(), false);
|
// in browsers.
|
||||||
}
|
if (localAudio) {
|
||||||
|
APP.settings.setMicDeviceId(
|
||||||
|
localAudio.getDeviceId(), false);
|
||||||
|
}
|
||||||
|
|
||||||
if (localVideo) {
|
if (localVideo) {
|
||||||
APP.settings.setCameraDeviceId(
|
APP.settings.setCameraDeviceId(
|
||||||
localVideo.getDeviceId(), false);
|
localVideo.getDeviceId(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
mediaDeviceHelper.setCurrentMediaDevices(devices);
|
mediaDeviceHelper.setCurrentMediaDevices(devices);
|
||||||
APP.UI.onAvailableDevicesChanged(devices);
|
APP.UI.onAvailableDevicesChanged(devices);
|
||||||
APP.store.dispatch(updateDeviceList(devices));
|
APP.store.dispatch(updateDeviceList(devices));
|
||||||
this.updateVideoIconEnabled();
|
this.updateVideoIconEnabled();
|
||||||
|
});
|
||||||
|
|
||||||
|
this.deviceChangeListener = (devices) =>
|
||||||
|
window.setTimeout(
|
||||||
|
() => this._onDeviceListChanged(devices), 0);
|
||||||
|
JitsiMeetJS.mediaDevices.addEventListener(
|
||||||
|
JitsiMeetJS.events.mediaDevices.DEVICE_LIST_CHANGED,
|
||||||
|
this.deviceChangeListener);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
logger.warn(`Error getting device list: ${error}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
this.deviceChangeListener = (devices) =>
|
|
||||||
window.setTimeout(
|
|
||||||
() => this._onDeviceListChanged(devices), 0);
|
|
||||||
JitsiMeetJS.mediaDevices.addEventListener(
|
|
||||||
JitsiMeetJS.events.mediaDevices.DEVICE_LIST_CHANGED,
|
|
||||||
this.deviceChangeListener);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Event listener for JitsiMediaDevicesEvents.DEVICE_LIST_CHANGED to
|
* Event listener for JitsiMediaDevicesEvents.DEVICE_LIST_CHANGED to
|
||||||
|
|
Loading…
Reference in New Issue