diff --git a/lang/main.json b/lang/main.json index df29473f639b..c41550062a50 100644 --- a/lang/main.json +++ b/lang/main.json @@ -504,6 +504,7 @@ "poweredby": "powered by", "prejoin": { "audioAndVideoError": "Audio and video error:", + "audioDeviceProblem": "There is a problem with your audio device", "audioOnlyError": "Audio error:", "audioTrackError": "Could not create audio track.", "calling": "Calling", diff --git a/react/features/prejoin/middleware.js b/react/features/prejoin/middleware.js index c590d1b8860b..fc436ae8c18e 100644 --- a/react/features/prejoin/middleware.js +++ b/react/features/prejoin/middleware.js @@ -4,10 +4,19 @@ import { updateConfig } from '../base/config'; import { SET_AUDIO_MUTED, SET_VIDEO_MUTED } from '../base/media'; import { MiddlewareRegistry } from '../base/redux'; import { updateSettings } from '../base/settings'; -import { getLocalVideoTrack, replaceLocalTrack } from '../base/tracks'; +import { + getLocalVideoTrack, + replaceLocalTrack, + TRACK_ADDED, + TRACK_NO_DATA_FROM_SOURCE +} from '../base/tracks'; import { PREJOIN_START_CONFERENCE } from './actionTypes'; -import { setPrejoinPageVisibility } from './actions'; +import { + setDeviceStatusOk, + setDeviceStatusWarning, + setPrejoinPageVisibility +} from './actions'; import { isPrejoinPageVisible } from './functions'; declare var APP: Object; @@ -63,6 +72,30 @@ MiddlewareRegistry.register(store => next => async action => { break; } + case TRACK_ADDED: + case TRACK_NO_DATA_FROM_SOURCE: { + const state = store.getState(); + + if (isPrejoinPageVisible(state)) { + const { track: { jitsiTrack: track } } = action; + const { deviceStatusType, deviceStatusText } = state['features/prejoin']; + + if (!track.isAudioTrack()) { + break; + } + + if (track.isReceivingData()) { + if (deviceStatusType === 'warning' + && deviceStatusText === 'prejoin.audioDeviceProblem') { + store.dispatch(setDeviceStatusOk('prejoin.lookGood')); + } + } else if (deviceStatusType === 'ok') { + store.dispatch(setDeviceStatusWarning('prejoin.audioDeviceProblem')); + } + } + break; + } + } return next(action); diff --git a/react/features/prejoin/reducer.js b/react/features/prejoin/reducer.js index c27ee025fcb1..f4702f74ec60 100644 --- a/react/features/prejoin/reducer.js +++ b/react/features/prejoin/reducer.js @@ -68,10 +68,12 @@ ReducerRegistry.register( } case SET_DEVICE_STATUS: { + const { deviceStatusType, deviceStatusText } = action.value; + return { ...state, - deviceStatusText: action.text, - deviceStatusType: action.type + deviceStatusText, + deviceStatusType }; }