Merge pull request #8612 from Tainan404/issue-8604

Add debounce to mute/unmute button
This commit is contained in:
Anton Georgiev 2020-02-14 16:54:31 -05:00 committed by GitHub
commit 45ab79ec96
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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,