fix my errors in gigantic merge + linting

auto_join_3.3
Stefan Otto 2020-05-06 18:47:14 +02:00
parent 57bb55764f
commit 3f1d102c59
3 changed files with 22 additions and 90 deletions

View File

@ -953,20 +953,24 @@ export default class RoomClient
} }
} }
disconnectLocalHark() { disconnectLocalHark()
{
logger.debug('disconnectLocalHark() | Stopping harkStream.'); logger.debug('disconnectLocalHark() | Stopping harkStream.');
if (this._harkStream != null) { if (this._harkStream != null)
{
this._harkStream.getAudioTracks()[0].stop(); this._harkStream.getAudioTracks()[0].stop();
this._harkStream = null; this._harkStream = null;
} }
if (this._hark != null) { if (this._hark != null)
{
logger.debug('disconnectLocalHark() Stopping hark.'); logger.debug('disconnectLocalHark() Stopping hark.');
this._hark.stop(); this._hark.stop();
} }
} }
connectLocalHark(track) { connectLocalHark(track)
{
logger.debug('connectLocalHark() | Track:%o', track); logger.debug('connectLocalHark() | Track:%o', track);
this._harkStream = new MediaStream(); this._harkStream = new MediaStream();
@ -979,7 +983,8 @@ export default class RoomClient
this._hark = hark(this._harkStream, { play: false }); this._hark = hark(this._harkStream, { play: false });
// eslint-disable-next-line no-unused-vars // 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: // The exact formula to convert from dBs (-100..0) to linear (0..1) is:
// Math.pow(10, dBs / 20) // Math.pow(10, dBs / 20)
// However it does not produce a visually useful output, so let exagerate // However it does not produce a visually useful output, so let exagerate
@ -992,21 +997,23 @@ export default class RoomClient
volume = Math.round(volume); volume = Math.round(volume);
if (this._micProducer && volume !== this._micProducer.volume) { if (this._micProducer && volume !== this._micProducer.volume)
{
this._micProducer.volume = volume; this._micProducer.volume = volume;
store.dispatch(peerVolumeActions.setPeerVolume(this._peerId, volume)); store.dispatch(peerVolumeActions.setPeerVolume(this._peerId, volume));
} }
}); });
this._hark.on('speaking', function () { this._hark.on('speaking', function()
{
store.dispatch(meActions.setIsSpeaking(true)); store.dispatch(meActions.setIsSpeaking(true));
}); });
this._hark.on('stopped_speaking', function () { this._hark.on('stopped_speaking', function()
{
store.dispatch(meActions.setIsSpeaking(false)); store.dispatch(meActions.setIsSpeaking(false));
}); });
} }
async changeAudioDevice(deviceId) async changeAudioDevice(deviceId)
{ {
logger.debug('changeAudioDevice() [deviceId: %s]', deviceId); logger.debug('changeAudioDevice() [deviceId: %s]', deviceId);
@ -1106,37 +1113,6 @@ export default class RoomClient
meActions.setAudioOutputInProgress(false)); 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) async changeVideoResolution(resolution)
{ {
logger.debug('changeVideoResolution() [resolution: %s]', resolution); logger.debug('changeVideoResolution() [resolution: %s]', resolution);
@ -1826,49 +1802,6 @@ export default class RoomClient
this._recvTransport = null; 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')); store.dispatch(roomActions.setRoomState('connecting'));
}); });

View File

@ -12,10 +12,6 @@ const peersKeySelector = createSelector(
peersSelector, peersSelector,
(peers) => Object.keys(peers) (peers) => Object.keys(peers)
); );
const peersValueSelector = createSelector(
peersSelector,
(peers) => Object.values(peers)
);
export const peersValueSelector = createSelector( export const peersValueSelector = createSelector(
peersSelector, peersSelector,

View File

@ -257,7 +257,8 @@ const MediaSettings = ({
className={classes.setting} className={classes.setting}
control={ control={
<Checkbox checked={settings.echoCancellation} onChange={ <Checkbox checked={settings.echoCancellation} onChange={
(event) => { (event) =>
{
setEchoCancellation(event.target.checked); setEchoCancellation(event.target.checked);
roomClient.changeAudioDevice(settings.selectedAudioDevice); roomClient.changeAudioDevice(settings.selectedAudioDevice);
}} }}
@ -271,7 +272,8 @@ const MediaSettings = ({
className={classes.setting} className={classes.setting}
control={ control={
<Checkbox checked={settings.autoGainControl} onChange={ <Checkbox checked={settings.autoGainControl} onChange={
(event) => { (event) =>
{
setAutoGainControl(event.target.checked); setAutoGainControl(event.target.checked);
roomClient.changeAudioDevice(settings.selectedAudioDevice); roomClient.changeAudioDevice(settings.selectedAudioDevice);
}} }}
@ -285,7 +287,8 @@ const MediaSettings = ({
className={classes.setting} className={classes.setting}
control={ control={
<Checkbox checked={settings.noiseSuppression} onChange={ <Checkbox checked={settings.noiseSuppression} onChange={
(event) => { (event) =>
{
setNoiseSuppression(event.target.checked); setNoiseSuppression(event.target.checked);
roomClient.changeAudioDevice(settings.selectedAudioDevice); roomClient.changeAudioDevice(settings.selectedAudioDevice);
}} }}