feat(prejoin): Show warning if audio device does not receive data

This commit is contained in:
Vlad Piersec 2020-08-12 10:19:31 +03:00 committed by Hristo Terezov
parent 5d012c24a7
commit 4bd57692b7
3 changed files with 40 additions and 4 deletions

View File

@ -504,6 +504,7 @@
"poweredby": "powered by", "poweredby": "powered by",
"prejoin": { "prejoin": {
"audioAndVideoError": "Audio and video error:", "audioAndVideoError": "Audio and video error:",
"audioDeviceProblem": "There is a problem with your audio device",
"audioOnlyError": "Audio error:", "audioOnlyError": "Audio error:",
"audioTrackError": "Could not create audio track.", "audioTrackError": "Could not create audio track.",
"calling": "Calling", "calling": "Calling",

View File

@ -4,10 +4,19 @@ import { updateConfig } from '../base/config';
import { SET_AUDIO_MUTED, SET_VIDEO_MUTED } from '../base/media'; import { SET_AUDIO_MUTED, SET_VIDEO_MUTED } from '../base/media';
import { MiddlewareRegistry } from '../base/redux'; import { MiddlewareRegistry } from '../base/redux';
import { updateSettings } from '../base/settings'; 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 { PREJOIN_START_CONFERENCE } from './actionTypes';
import { setPrejoinPageVisibility } from './actions'; import {
setDeviceStatusOk,
setDeviceStatusWarning,
setPrejoinPageVisibility
} from './actions';
import { isPrejoinPageVisible } from './functions'; import { isPrejoinPageVisible } from './functions';
declare var APP: Object; declare var APP: Object;
@ -63,6 +72,30 @@ MiddlewareRegistry.register(store => next => async action => {
break; 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); return next(action);

View File

@ -68,10 +68,12 @@ ReducerRegistry.register(
} }
case SET_DEVICE_STATUS: { case SET_DEVICE_STATUS: {
const { deviceStatusType, deviceStatusText } = action.value;
return { return {
...state, ...state,
deviceStatusText: action.text, deviceStatusText,
deviceStatusType: action.type deviceStatusType
}; };
} }