From 10969f2601fb01799bdb1053f4ec0461fe84edb6 Mon Sep 17 00:00:00 2001 From: Tainan Felipe Date: Thu, 6 Feb 2020 17:20:42 -0300 Subject: [PATCH] Add debounce to mute/unmute button --- bigbluebutton-html5/imports/ui/components/audio/service.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bigbluebutton-html5/imports/ui/components/audio/service.js b/bigbluebutton-html5/imports/ui/components/audio/service.js index 78cd1f4fd3..0e7ffaf27c 100755 --- a/bigbluebutton-html5/imports/ui/components/audio/service.js +++ b/bigbluebutton-html5/imports/ui/components/audio/service.js @@ -1,5 +1,6 @@ import Users from '/imports/api/users'; import Auth from '/imports/ui/services/auth'; +import { debounce } from 'lodash'; import AudioManager from '/imports/ui/services/audio-manager'; import Meetings from '/imports/api/meetings'; import { makeCall } from '/imports/ui/services/api'; @@ -39,7 +40,6 @@ const isVoiceUser = () => { { fields: { joined: 1 } }); return voiceUser ? voiceUser.joined : false; }; - const toggleMuteMicrophone = () => { const user = VoiceUsers.findOne({ meetingId: Auth.meetingID, intId: Auth.userID, @@ -60,6 +60,7 @@ const toggleMuteMicrophone = () => { } }; + export default { init, exitAudio: () => AudioManager.exitAudio(), @@ -67,7 +68,7 @@ export default { joinListenOnly: () => AudioManager.joinListenOnly(), joinMicrophone: () => AudioManager.joinMicrophone(), joinEchoTest: () => AudioManager.joinEchoTest(), - toggleMuteMicrophone, + toggleMuteMicrophone: debounce(toggleMuteMicrophone, 500, { leading: true, trailing: false }), changeInputDevice: inputDeviceId => AudioManager.changeInputDevice(inputDeviceId), changeOutputDevice: outputDeviceId => AudioManager.changeOutputDevice(outputDeviceId), isConnected: () => AudioManager.isConnected,