From 8b23265a50214a73a00ee22593d8ea97de59a1c9 Mon Sep 17 00:00:00 2001 From: hmuresan Date: Tue, 24 Aug 2021 14:20:53 +0300 Subject: [PATCH] fix(notifications) Add timeout for video/audio lost notifs --- react/features/base/devices/middleware.js | 5 +++-- react/features/notifications/actions.js | 6 ++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/react/features/base/devices/middleware.js b/react/features/base/devices/middleware.js index b11f6251a..7e9bba81f 100644 --- a/react/features/base/devices/middleware.js +++ b/react/features/base/devices/middleware.js @@ -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. @@ -133,7 +134,7 @@ MiddlewareRegistry.register(store => next => action => { description: additionalCameraErrorMsg, descriptionKey: cameraErrorMsg, titleKey - })); + }, WARNING_DISPLAY_TIMER)); if (isPrejoinPageVisible(store.getState())) { store.dispatch(setDeviceStatusWarning(titleKey)); @@ -162,7 +163,7 @@ MiddlewareRegistry.register(store => next => action => { description: additionalMicErrorMsg, descriptionKey: micErrorMsg, titleKey - })); + }, WARNING_DISPLAY_TIMER)); if (isPrejoinPageVisible(store.getState())) { store.dispatch(setDeviceStatusWarning(titleKey)); diff --git a/react/features/notifications/actions.js b/react/features/notifications/actions.js index d020d7804..f9c100e3a 100644 --- a/react/features/notifications/actions.js +++ b/react/features/notifications/actions.js @@ -105,13 +105,15 @@ export function showNotification(props: Object = {}, timeout: ?number) { * Queues a warning notification for display. * * @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} */ -export function showWarningNotification(props: Object) { +export function showWarningNotification(props: Object, timeout: ?number) { return showNotification({ ...props, appearance: NOTIFICATION_TYPE.WARNING - }); + }, timeout); } /**