From 73fb586d593d65d8919edb93453490acb91478a4 Mon Sep 17 00:00:00 2001 From: tmoldovan8x8 <62697631+tmoldovan8x8@users.noreply.github.com> Date: Fri, 26 Nov 2021 12:09:21 +0200 Subject: [PATCH] fix(external-api) send AUDIO_MUTED_CHANGED event only when value changed --- react/features/mobile/external-api/middleware.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/react/features/mobile/external-api/middleware.js b/react/features/mobile/external-api/middleware.js index 3a4a24eb0..991954685 100644 --- a/react/features/mobile/external-api/middleware.js +++ b/react/features/mobile/external-api/middleware.js @@ -93,6 +93,7 @@ const eventEmitter = new NativeEventEmitter(ExternalAPI); * @returns {Function} */ MiddlewareRegistry.register(store => next => action => { + const oldAudioMuted = store.getState()['features/base/media'].audio.muted; const result = next(action); const { type } = action; @@ -198,12 +199,14 @@ MiddlewareRegistry.register(store => next => action => { break; case SET_AUDIO_MUTED: - sendEvent( - store, - 'AUDIO_MUTED_CHANGED', - /* data */ { - muted: action.muted - }); + if (action.muted !== oldAudioMuted) { + sendEvent( + store, + 'AUDIO_MUTED_CHANGED', + /* data */ { + muted: action.muted + }); + } break; case SET_PAGE_RELOAD_OVERLAY_CANCELED: