Merge pull request #653 from tsareg/device_list_change_basic_support

Update devices in settings panel when list of available devices changes
This commit is contained in:
yanas 2016-05-12 15:02:19 -05:00
commit eda11f4657
3 changed files with 14 additions and 11 deletions

View File

@ -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();

View File

@ -218,7 +218,7 @@ export default {
);
if (audioOutput.length &&
JitsiMeetJS.isDeviceChangeAvailable('output')) {
JitsiMeetJS.mediaDevices.isDeviceChangeAvailable('output')) {
$selectAudioOutput.html(
generateDevicesOptions(audioOutput,
Settings.getAudioOutputDeviceId()));

View File

@ -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);
},