Added ability to notify about available media device list changes
This commit is contained in:
parent
49e60a8b4f
commit
474155ce9d
|
@ -371,11 +371,14 @@ export default {
|
||||||
JitsiMeetJS.isDesktopSharingEnabled();
|
JitsiMeetJS.isDesktopSharingEnabled();
|
||||||
|
|
||||||
// update list of available devices
|
// update list of available devices
|
||||||
if (JitsiMeetJS.isDeviceListAvailable() &&
|
if (JitsiMeetJS.mediaDevices.isDeviceListAvailable() &&
|
||||||
JitsiMeetJS.isDeviceChangeAvailable()) {
|
JitsiMeetJS.mediaDevices.isDeviceChangeAvailable()) {
|
||||||
JitsiMeetJS.enumerateDevices(
|
JitsiMeetJS.mediaDevices.enumerateDevices(
|
||||||
devices => APP.UI.onAvailableDevicesChanged(devices)
|
APP.UI.onAvailableDevicesChanged);
|
||||||
);
|
|
||||||
|
JitsiMeetJS.mediaDevices.addEventListener(
|
||||||
|
JitsiMeetJS.events.mediaDevices.DEVICE_LIST_CHANGED,
|
||||||
|
APP.UI.onAvailableDevicesChanged);
|
||||||
}
|
}
|
||||||
if (config.iAmRecorder)
|
if (config.iAmRecorder)
|
||||||
this.recorder = new Recorder();
|
this.recorder = new Recorder();
|
||||||
|
|
|
@ -218,7 +218,7 @@ export default {
|
||||||
);
|
);
|
||||||
|
|
||||||
if (audioOutput.length &&
|
if (audioOutput.length &&
|
||||||
JitsiMeetJS.isDeviceChangeAvailable('output')) {
|
JitsiMeetJS.mediaDevices.isDeviceChangeAvailable('output')) {
|
||||||
$selectAudioOutput.html(
|
$selectAudioOutput.html(
|
||||||
generateDevicesOptions(audioOutput,
|
generateDevicesOptions(audioOutput,
|
||||||
Settings.getAudioOutputDeviceId()));
|
Settings.getAudioOutputDeviceId()));
|
||||||
|
|
|
@ -45,9 +45,9 @@ if (supportsLocalStorage()) {
|
||||||
|
|
||||||
var audioOutputDeviceId = window.localStorage.audioOutputDeviceId;
|
var audioOutputDeviceId = window.localStorage.audioOutputDeviceId;
|
||||||
|
|
||||||
if (typeof audioOutputDeviceId !== 'undefined' &&
|
if (typeof audioOutputDeviceId !== 'undefined' && audioOutputDeviceId !==
|
||||||
audioOutputDeviceId !== JitsiMeetJS.getAudioOutputDevice()) {
|
JitsiMeetJS.mediaDevices.getAudioOutputDevice()) {
|
||||||
JitsiMeetJS.setAudioOutputDevice(
|
JitsiMeetJS.mediaDevices.setAudioOutputDevice(
|
||||||
window.localStorage.audioOutputDeviceId).catch((ex) => {
|
window.localStorage.audioOutputDeviceId).catch((ex) => {
|
||||||
console.error('failed to set audio output device from local ' +
|
console.error('failed to set audio output device from local ' +
|
||||||
'storage', ex);
|
'storage', ex);
|
||||||
|
@ -161,7 +161,7 @@ export default {
|
||||||
* @returns {String}
|
* @returns {String}
|
||||||
*/
|
*/
|
||||||
getAudioOutputDeviceId: function () {
|
getAudioOutputDeviceId: function () {
|
||||||
return JitsiMeetJS.getAudioOutputDevice();
|
return JitsiMeetJS.mediaDevices.getAudioOutputDevice();
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Set device id of the audio output device which is currently in use.
|
* Set device id of the audio output device which is currently in use.
|
||||||
|
@ -170,7 +170,7 @@ export default {
|
||||||
* @returns {Promise}
|
* @returns {Promise}
|
||||||
*/
|
*/
|
||||||
setAudioOutputDeviceId: function (newId = '') {
|
setAudioOutputDeviceId: function (newId = '') {
|
||||||
return JitsiMeetJS.setAudioOutputDevice(newId)
|
return JitsiMeetJS.mediaDevices.setAudioOutputDevice(newId)
|
||||||
.then(() => window.localStorage.audioOutputDeviceId = newId);
|
.then(() => window.localStorage.audioOutputDeviceId = newId);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue