Merge pull request #18906 from Tainan404/hotfix-audio-captions

Hotfix: Audio captions not working properly
This commit is contained in:
Ramón Souza 2023-10-06 17:17:06 -03:00 committed by GitHub
commit fd1a27fe21
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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);
};