Skip to content

Commit

Permalink
feat(prejoin): Show warning if audio device does not receive data
Browse files Browse the repository at this point in the history
  • Loading branch information
vp8x8 authored and hristoterezov committed Aug 25, 2020
1 parent 5d012c2 commit 4bd5769
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 4 deletions.
1 change: 1 addition & 0 deletions lang/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
37 changes: 35 additions & 2 deletions react/features/prejoin/middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
6 changes: 4 additions & 2 deletions react/features/prejoin/reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
};
}

Expand Down

0 comments on commit 4bd5769

Please sign in to comment.