diff --git a/bigbluebutton-html5/imports/api/voice-users/server/modifiers/updateVoiceUser.js b/bigbluebutton-html5/imports/api/voice-users/server/modifiers/updateVoiceUser.js index ddd8435f05..5b86dca2ec 100644 --- a/bigbluebutton-html5/imports/api/voice-users/server/modifiers/updateVoiceUser.js +++ b/bigbluebutton-html5/imports/api/voice-users/server/modifiers/updateVoiceUser.js @@ -4,7 +4,7 @@ import VoiceUsers from '/imports/api/voice-users'; import flat from 'flat'; import { spokeTimeoutHandles, clearSpokeTimeout } from '/imports/api/common/server/helpers'; -const TALKING_TIMEOUT = 3000; +const TALKING_TIMEOUT = 6000; export default function updateVoiceUser(meetingId, voiceUser) { check(meetingId, String); @@ -31,8 +31,14 @@ export default function updateVoiceUser(meetingId, voiceUser) { }; if (voiceUser.talking) { + const user = VoiceUsers.findOne({ meetingId, intId }, { + fields: { + startTime: 1, + }, + }); + + if (user && !user.startTime) modifier.$set.startTime = Date.now(); modifier.$set.spoke = true; - modifier.$set.startTime = Date.now(); modifier.$set.endTime = null; clearSpokeTimeout(meetingId, intId); } @@ -59,6 +65,7 @@ export default function updateVoiceUser(meetingId, voiceUser) { const spokeDelay = ((Date.now() - endTime) < TALKING_TIMEOUT); if (talking || spokeDelay) return; modifier.$set.spoke = false; + modifier.$set.startTime = null; VoiceUsers.update(selector, modifier, cb); } }, TALKING_TIMEOUT); diff --git a/bigbluebutton-html5/imports/ui/components/nav-bar/talking-indicator/container.jsx b/bigbluebutton-html5/imports/ui/components/nav-bar/talking-indicator/container.jsx index b7359b907f..2bf9127dc8 100644 --- a/bigbluebutton-html5/imports/ui/components/nav-bar/talking-indicator/container.jsx +++ b/bigbluebutton-html5/imports/ui/components/nav-bar/talking-indicator/container.jsx @@ -4,6 +4,7 @@ import VoiceUsers from '/imports/api/voice-users'; import Auth from '/imports/ui/services/auth'; import TalkingIndicator from './component'; import { makeCall } from '/imports/ui/services/api'; +import Service from './service'; const APP_CONFIG = Meteor.settings.public.app; const { enableTalkingIndicator } = APP_CONFIG; @@ -25,7 +26,7 @@ export default withTracker(() => { voiceUserId: 1, muted: 1, }, - }).fetch(); + }).fetch().sort(Service.sortVoiceUsers); if (usersTalking) { for (let i = 0; i < usersTalking.length; i += 1) { diff --git a/bigbluebutton-html5/imports/ui/components/nav-bar/talking-indicator/service.js b/bigbluebutton-html5/imports/ui/components/nav-bar/talking-indicator/service.js new file mode 100644 index 0000000000..e1f0d0b20d --- /dev/null +++ b/bigbluebutton-html5/imports/ui/components/nav-bar/talking-indicator/service.js @@ -0,0 +1,14 @@ +const sortByStartTime = (a, b) => { + if (a.startTime < b.startTime) return -1; + if (a.startTime > b.startTime) return 1; + return 0; +}; + +const sortVoiceUsers = (a, b) => { + const sort = sortByStartTime(a, b); + return sort; +}; + +export default { + sortVoiceUsers, +};