diff --git a/app/src/RoomClient.js b/app/src/RoomClient.js index 8d0e01f..219cb10 100644 --- a/app/src/RoomClient.js +++ b/app/src/RoomClient.js @@ -244,6 +244,8 @@ export default class RoomClient this._audioDevices = {}; + this._audioOutputDevices = {}; + // mediasoup Consumers. // @type {Map} this._consumers = new Map(); @@ -1107,6 +1109,50 @@ export default class RoomClient meActions.setAudioInProgress(false)); } + async changeAudioOutputDevice(deviceId) + { + logger.debug('changeAudioOutputDevice() [deviceId: %s]', deviceId); + + store.dispatch( + meActions.setAudioOutputInProgress(true)); + + try + { + const device = this._audioOutputDevices[deviceId]; + + if (!device) + throw new Error('Selected audio output device no longer avaibale'); + + logger.debug( + 'changeAudioOutputDevice() | new selected [audio output device:%o]', + device); + + + + const audioElements = document.getElementById("audio"); + for( let i=0; i me : { audioDevices : null, audioInProgress : false, + audioOutputDevices : null, + audioOutputInProgress : false, canSendMic : false, canSendWebcam : false, canShareFiles : false, @@ -72,11 +74,12 @@ beforeEach(() => windowConsumer : null }, settings : { - advancedMode : true, - displayName : 'Jest Tester', - resolution : 'ultra', - selectedAudioDevice : 'default', - selectedWebcam : 'soifjsiajosjfoi' + advancedMode : true, + displayName : 'Jest Tester', + resolution : 'ultra', + selectedAudioDevice : 'default', + selectedAudioOutputDevice : 'default', + selectedWebcam : 'soifjsiajosjfoi' }, toolarea : { currentToolTab : 'chat', diff --git a/app/src/actions/meActions.js b/app/src/actions/meActions.js index fc72592..9c350da 100644 --- a/app/src/actions/meActions.js +++ b/app/src/actions/meActions.js @@ -50,6 +50,12 @@ export const setAudioDevices = (devices) => payload : { devices } }); +export const setAudioOutputDevices = (devices) => +({ + type : 'SET_AUDIO_OUTPUT_DEVICES', + payload : { devices } +}); + export const setWebcamDevices = (devices) => ({ type : 'SET_WEBCAM_DEVICES', @@ -67,6 +73,12 @@ export const setAudioInProgress = (flag) => type : 'SET_AUDIO_IN_PROGRESS', payload : { flag } }); + +export const setAudioOutputInProgress = (flag) => +({ + type : 'SET_AUDIO_OUTPUT_IN_PROGRESS', + payload : { flag } +}); export const setWebcamInProgress = (flag) => ({ diff --git a/app/src/actions/settingsActions.js b/app/src/actions/settingsActions.js index 79b5ef2..e66d437 100644 --- a/app/src/actions/settingsActions.js +++ b/app/src/actions/settingsActions.js @@ -4,6 +4,12 @@ export const setSelectedAudioDevice = (deviceId) => payload : { deviceId } }); +export const setSelectedAudioOutputDevice = (deviceId) => +({ + type : 'CHANGE_AUDIO_OUTPUT_DEVICE', + payload : { deviceId } +}); + export const setSelectedWebcamDevice = (deviceId) => ({ type : 'CHANGE_WEBCAM', diff --git a/app/src/components/Settings/Settings.js b/app/src/components/Settings/Settings.js index 91ba0db..4ad8c0c 100644 --- a/app/src/components/Settings/Settings.js +++ b/app/src/components/Settings/Settings.js @@ -130,6 +130,13 @@ const Settings = ({ audioDevices = Object.values(me.audioDevices); else audioDevices = []; + + let audioOutputDevices; + + if (me.audioOutputDevices) + audioOutputDevices = Object.values(me.audioOutputDevices); + else + audioOutputDevices = []; return ( +
+ + + + { audioOutputDevices.length > 0 ? + intl.formatMessage({ + id : 'settings.selectAudio.output', + defaultMessage : 'Select audio output device' + }) + : + intl.formatMessage({ + id : 'settings.cantSelectAudio.output', + defaultMessage : 'Unable to select audio output device' + }) + } + + +