diff --git a/conference.js b/conference.js index 8feef2114..5a6e9f0d5 100644 --- a/conference.js +++ b/conference.js @@ -371,11 +371,14 @@ export default { JitsiMeetJS.isDesktopSharingEnabled(); // update list of available devices - if (JitsiMeetJS.isDeviceListAvailable() && - JitsiMeetJS.isDeviceChangeAvailable()) { - JitsiMeetJS.enumerateDevices( - devices => APP.UI.onAvailableDevicesChanged(devices) - ); + if (JitsiMeetJS.mediaDevices.isDeviceListAvailable() && + JitsiMeetJS.mediaDevices.isDeviceChangeAvailable()) { + JitsiMeetJS.mediaDevices.enumerateDevices( + APP.UI.onAvailableDevicesChanged); + + JitsiMeetJS.mediaDevices.addEventListener( + JitsiMeetJS.events.mediaDevices.DEVICE_LIST_CHANGED, + APP.UI.onAvailableDevicesChanged); } if (config.iAmRecorder) this.recorder = new Recorder(); diff --git a/modules/UI/side_pannels/settings/SettingsMenu.js b/modules/UI/side_pannels/settings/SettingsMenu.js index 0d76809f2..ce9831d96 100644 --- a/modules/UI/side_pannels/settings/SettingsMenu.js +++ b/modules/UI/side_pannels/settings/SettingsMenu.js @@ -218,7 +218,7 @@ export default { ); if (audioOutput.length && - JitsiMeetJS.isDeviceChangeAvailable('output')) { + JitsiMeetJS.mediaDevices.isDeviceChangeAvailable('output')) { $selectAudioOutput.html( generateDevicesOptions(audioOutput, Settings.getAudioOutputDeviceId())); diff --git a/modules/settings/Settings.js b/modules/settings/Settings.js index 83a1609e8..798de4515 100644 --- a/modules/settings/Settings.js +++ b/modules/settings/Settings.js @@ -45,9 +45,9 @@ if (supportsLocalStorage()) { var audioOutputDeviceId = window.localStorage.audioOutputDeviceId; - if (typeof audioOutputDeviceId !== 'undefined' && - audioOutputDeviceId !== JitsiMeetJS.getAudioOutputDevice()) { - JitsiMeetJS.setAudioOutputDevice( + if (typeof audioOutputDeviceId !== 'undefined' && audioOutputDeviceId !== + JitsiMeetJS.mediaDevices.getAudioOutputDevice()) { + JitsiMeetJS.mediaDevices.setAudioOutputDevice( window.localStorage.audioOutputDeviceId).catch((ex) => { console.error('failed to set audio output device from local ' + 'storage', ex); @@ -161,7 +161,7 @@ export default { * @returns {String} */ getAudioOutputDeviceId: function () { - return JitsiMeetJS.getAudioOutputDevice(); + return JitsiMeetJS.mediaDevices.getAudioOutputDevice(); }, /** * Set device id of the audio output device which is currently in use. @@ -170,7 +170,7 @@ export default { * @returns {Promise} */ setAudioOutputDeviceId: function (newId = '') { - return JitsiMeetJS.setAudioOutputDevice(newId) + return JitsiMeetJS.mediaDevices.setAudioOutputDevice(newId) .then(() => window.localStorage.audioOutputDeviceId = newId); },