Add debounce to mute/unmute button

This commit is contained in:
Tainan Felipe 2020-02-06 17:20:42 -03:00
parent 419a5e46a8
commit 10969f2601

View File

@ -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,