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",
"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",

View File

@ -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);

View File

@ -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
};
}