fix(notifications) Add timeout for video/audio lost notifs

This commit is contained in:
hmuresan 2021-08-24 14:20:53 +03:00 committed by Horatiu Muresan
parent 5bc424459f
commit 8b23265a50
2 changed files with 7 additions and 4 deletions

View File

@ -50,6 +50,7 @@ const JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP = {
} }
}; };
const WARNING_DISPLAY_TIMER = 4000;
/** /**
* A listener for device permissions changed reported from lib-jitsi-meet. * A listener for device permissions changed reported from lib-jitsi-meet.
@ -133,7 +134,7 @@ MiddlewareRegistry.register(store => next => action => {
description: additionalCameraErrorMsg, description: additionalCameraErrorMsg,
descriptionKey: cameraErrorMsg, descriptionKey: cameraErrorMsg,
titleKey titleKey
})); }, WARNING_DISPLAY_TIMER));
if (isPrejoinPageVisible(store.getState())) { if (isPrejoinPageVisible(store.getState())) {
store.dispatch(setDeviceStatusWarning(titleKey)); store.dispatch(setDeviceStatusWarning(titleKey));
@ -162,7 +163,7 @@ MiddlewareRegistry.register(store => next => action => {
description: additionalMicErrorMsg, description: additionalMicErrorMsg,
descriptionKey: micErrorMsg, descriptionKey: micErrorMsg,
titleKey titleKey
})); }, WARNING_DISPLAY_TIMER));
if (isPrejoinPageVisible(store.getState())) { if (isPrejoinPageVisible(store.getState())) {
store.dispatch(setDeviceStatusWarning(titleKey)); store.dispatch(setDeviceStatusWarning(titleKey));

View File

@ -105,13 +105,15 @@ export function showNotification(props: Object = {}, timeout: ?number) {
* Queues a warning notification for display. * Queues a warning notification for display.
* *
* @param {Object} props - The props needed to show the notification component. * @param {Object} props - The props needed to show the notification component.
* @param {number} timeout - How long the notification should display before
* automatically being hidden.
* @returns {Object} * @returns {Object}
*/ */
export function showWarningNotification(props: Object) { export function showWarningNotification(props: Object, timeout: ?number) {
return showNotification({ return showNotification({
...props, ...props,
appearance: NOTIFICATION_TYPE.WARNING appearance: NOTIFICATION_TYPE.WARNING
}); }, timeout);
} }
/** /**