fix an error when testing a result from a method that returns a promise

This commit is contained in:
bbaldino 2017-07-14 18:45:32 +00:00
parent 37328b3995
commit 7d99c54ec8
1 changed files with 33 additions and 26 deletions

View File

@ -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