diff --git a/app/src/RoomClient.js b/app/src/RoomClient.js index 7fd9cb5..df276ae 100644 --- a/app/src/RoomClient.js +++ b/app/src/RoomClient.js @@ -953,20 +953,24 @@ export default class RoomClient } } - disconnectLocalHark() { + disconnectLocalHark() + { logger.debug('disconnectLocalHark() | Stopping harkStream.'); - if (this._harkStream != null) { + if (this._harkStream != null) + { this._harkStream.getAudioTracks()[0].stop(); this._harkStream = null; } - if (this._hark != null) { + if (this._hark != null) + { logger.debug('disconnectLocalHark() Stopping hark.'); this._hark.stop(); } } - connectLocalHark(track) { + connectLocalHark(track) + { logger.debug('connectLocalHark() | Track:%o', track); this._harkStream = new MediaStream(); @@ -979,7 +983,8 @@ export default class RoomClient this._hark = hark(this._harkStream, { play: false }); // eslint-disable-next-line no-unused-vars - this._hark.on('volume_change', (dBs, threshold) => { + this._hark.on('volume_change', (dBs, threshold) => + { // The exact formula to convert from dBs (-100..0) to linear (0..1) is: // Math.pow(10, dBs / 20) // However it does not produce a visually useful output, so let exagerate @@ -992,21 +997,23 @@ export default class RoomClient volume = Math.round(volume); - if (this._micProducer && volume !== this._micProducer.volume) { + if (this._micProducer && volume !== this._micProducer.volume) + { this._micProducer.volume = volume; store.dispatch(peerVolumeActions.setPeerVolume(this._peerId, volume)); } }); - this._hark.on('speaking', function () { + this._hark.on('speaking', function() + { store.dispatch(meActions.setIsSpeaking(true)); }); - this._hark.on('stopped_speaking', function () { + this._hark.on('stopped_speaking', function() + { store.dispatch(meActions.setIsSpeaking(false)); }); } - async changeAudioDevice(deviceId) { logger.debug('changeAudioDevice() [deviceId: %s]', deviceId); @@ -1106,37 +1113,6 @@ export default class RoomClient meActions.setAudioOutputInProgress(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); - - store.dispatch(settingsActions.setSelectedAudioOutputDevice(deviceId)); - - await this._updateAudioOutputDevices(); - } - catch (error) - { - logger.error('changeAudioOutputDevice() failed: %o', error); - } - - store.dispatch( - meActions.setAudioOutputInProgress(false)); - } - async changeVideoResolution(resolution) { logger.debug('changeVideoResolution() [resolution: %s]', resolution); @@ -1826,49 +1802,6 @@ export default class RoomClient this._recvTransport = null; } - store.dispatch(roomActions.setRoomState('connecting')); - }); - - store.dispatch( - producerActions.removeProducer(this._screenSharingProducer.id)); - - this._screenSharingProducer = null; - } - - if (this._webcamProducer) - { - this._webcamProducer.close(); - - store.dispatch( - producerActions.removeProducer(this._webcamProducer.id)); - - this._webcamProducer = null; - } - - if (this._micProducer) - { - this._micProducer.close(); - - store.dispatch( - producerActions.removeProducer(this._micProducer.id)); - - this._micProducer = null; - } - - if (this._sendTransport) - { - this._sendTransport.close(); - - this._sendTransport = null; - } - - if (this._recvTransport) - { - this._recvTransport.close(); - - this._recvTransport = null; - } - store.dispatch(roomActions.setRoomState('connecting')); }); diff --git a/app/src/components/Selectors.js b/app/src/components/Selectors.js index 8f59d5d..b8e5e41 100644 --- a/app/src/components/Selectors.js +++ b/app/src/components/Selectors.js @@ -12,10 +12,6 @@ const peersKeySelector = createSelector( peersSelector, (peers) => Object.keys(peers) ); -const peersValueSelector = createSelector( - peersSelector, - (peers) => Object.values(peers) -); export const peersValueSelector = createSelector( peersSelector, diff --git a/app/src/components/Settings/MediaSettings.js b/app/src/components/Settings/MediaSettings.js index 392df88..d215181 100644 --- a/app/src/components/Settings/MediaSettings.js +++ b/app/src/components/Settings/MediaSettings.js @@ -257,7 +257,8 @@ const MediaSettings = ({ className={classes.setting} control={ { + (event) => + { setEchoCancellation(event.target.checked); roomClient.changeAudioDevice(settings.selectedAudioDevice); }} @@ -271,7 +272,8 @@ const MediaSettings = ({ className={classes.setting} control={ { + (event) => + { setAutoGainControl(event.target.checked); roomClient.changeAudioDevice(settings.selectedAudioDevice); }} @@ -285,7 +287,8 @@ const MediaSettings = ({ className={classes.setting} control={ { + (event) => + { setNoiseSuppression(event.target.checked); roomClient.changeAudioDevice(settings.selectedAudioDevice); }}