Address code review

This commit is contained in:
Andrei Gavrilescu 2019-12-05 14:11:26 +02:00 committed by Hristo Terezov
parent 4890390ea2
commit 851b1a76a9
2 changed files with 112 additions and 92 deletions

View File

@ -73,6 +73,11 @@ var config = {
// Disable measuring of audio levels. // Disable measuring of audio levels.
// disableAudioLevels: false, // disableAudioLevels: false,
// Enabling this will run the lib-jitsi-meet no audio detection module which
// will notify the user if the current selected microphone has no audio
// input and will suggest another valid device if one is present.
// enableNoAudioDetection: false
// Start the conference in audio only mode (no video is being received nor // Start the conference in audio only mode (no video is being received nor
// sent). // sent).
// startAudioOnly: false, // startAudioOnly: false,
@ -470,7 +475,6 @@ var config = {
disableNS disableNS
enableLipSync enableLipSync
enableTalkWhileMuted enableTalkWhileMuted
enableNoAudioDetection
forceJVB121Ratio forceJVB121Ratio
hiddenDomain hiddenDomain
ignoreStartMuted ignoreStartMuted

View File

@ -1,7 +1,5 @@
// @flow // @flow
import { setNoAudioSignalNotificationUid } from './actions';
import { NO_AUDIO_SIGNAL_SOUND_ID } from './constants';
import { NO_AUDIO_SIGNAL_SOUND_FILE } from './sounds';
import { APP_WILL_MOUNT, APP_WILL_UNMOUNT } from '../base/app'; import { APP_WILL_MOUNT, APP_WILL_UNMOUNT } from '../base/app';
import { CONFERENCE_JOINED } from '../base/conference'; import { CONFERENCE_JOINED } from '../base/conference';
import { import {
@ -14,11 +12,13 @@ import { updateSettings } from '../base/settings';
import { playSound, registerSound, unregisterSound } from '../base/sounds'; import { playSound, registerSound, unregisterSound } from '../base/sounds';
import { hideNotification, showNotification } from '../notifications'; import { hideNotification, showNotification } from '../notifications';
import { setNoAudioSignalNotificationUid } from './actions';
import { NO_AUDIO_SIGNAL_SOUND_ID } from './constants';
import { NO_AUDIO_SIGNAL_SOUND_FILE } from './sounds';
MiddlewareRegistry.register(store => next => async action => { MiddlewareRegistry.register(store => next => async action => {
const result = next(action); const result = next(action);
const { dispatch, getState } = store; const { dispatch } = store;
const { conference } = action;
let confAudioInputState;
switch (action.type) { switch (action.type) {
case APP_WILL_MOUNT: case APP_WILL_MOUNT:
@ -27,8 +27,29 @@ MiddlewareRegistry.register(store => next => async action => {
case APP_WILL_UNMOUNT: case APP_WILL_UNMOUNT:
dispatch(unregisterSound(NO_AUDIO_SIGNAL_SOUND_ID)); dispatch(unregisterSound(NO_AUDIO_SIGNAL_SOUND_ID));
break; break;
case CONFERENCE_JOINED:
_handleNoAudioSignalNotification(store, action);
break;
}
return result;
});
/**
* Handles the logic of displaying the no audio input detected notification as well as finding a valid device on the
* system.
*
* @param {Store} store - The redux store in which the specified action is being dispatched.
* @param {Action} action - The redux action {@code CONFERENCE_JOINED} which is being dispatched in the specified redux
* store.
* @private
* @returns {void}
*/
async function _handleNoAudioSignalNotification({ dispatch, getState }, action) {
const { conference } = action;
let confAudioInputState;
case CONFERENCE_JOINED: {
conference.on(JitsiConferenceEvents.AUDIO_INPUT_STATE_CHANGE, hasAudioInput => { conference.on(JitsiConferenceEvents.AUDIO_INPUT_STATE_CHANGE, hasAudioInput => {
const { noAudioSignalNotificationUid } = getState()['features/no-audio-signal']; const { noAudioSignalNotificationUid } = getState()['features/no-audio-signal'];
@ -111,9 +132,4 @@ MiddlewareRegistry.register(store => next => async action => {
// a new track was added, thus changing the context of the notification // a new track was added, thus changing the context of the notification
dispatch(setNoAudioSignalNotificationUid(notification.uid)); dispatch(setNoAudioSignalNotificationUid(notification.uid));
}); });
break; }
}
}
return result;
});