From fb0b98a6afd2c3688b58f41a36a8327a4daac555 Mon Sep 17 00:00:00 2001 From: Tainan Felipe Date: Fri, 6 Oct 2023 18:13:55 +0000 Subject: [PATCH] Hotfix: Audio captions not working properly --- .../ui/components/audio/captions/speech/service.js | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/bigbluebutton-html5/imports/ui/components/audio/captions/speech/service.js b/bigbluebutton-html5/imports/ui/components/audio/captions/speech/service.js index dbfc908122..4b8205ec81 100644 --- a/bigbluebutton-html5/imports/ui/components/audio/captions/speech/service.js +++ b/bigbluebutton-html5/imports/ui/components/audio/captions/speech/service.js @@ -1,4 +1,3 @@ -import { throttle } from '/imports/utils/throttle'; import { diff } from '@mconf/bbb-diff'; import { Session } from 'meteor/session'; import Auth from '/imports/ui/services/auth'; @@ -8,9 +7,9 @@ import Users from '/imports/api/users'; import AudioService from '/imports/ui/components/audio/service'; import deviceInfo from '/imports/utils/deviceInfo'; import { isLiveTranscriptionEnabled } from '/imports/ui/services/features'; -import { unique } from 'radash'; +import { unique, throttle } from 'radash'; -const THROTTLE_TIMEOUT = 1000; +const THROTTLE_TIMEOUT = 200; const CONFIG = Meteor.settings.public.app.audioCaptions; const ENABLED = CONFIG.enabled; @@ -105,17 +104,13 @@ const updateTranscript = (id, transcript, locale, isFinal) => { makeCall('updateTranscript', id, start, end, text, transcript, locale, isFinal); }; -const throttledTranscriptUpdate = throttle(updateTranscript, THROTTLE_TIMEOUT, { - leading: false, - trailing: true, -}); +const throttledTranscriptUpdate = throttle({ interval: THROTTLE_TIMEOUT }, updateTranscript); const updateInterimTranscript = (id, transcript, locale) => { throttledTranscriptUpdate(id, transcript, locale, false); }; const updateFinalTranscript = (id, transcript, locale) => { - throttledTranscriptUpdate.cancel(); updateTranscript(id, transcript, locale, true); };