Use WPM approach to delay the text

This commit is contained in:
2023-09-26 14:59:59 -04:00
committed by Mathieu Virbel
parent 53e0c5cb88
commit 869dc893b9

View File

@@ -31,7 +31,9 @@ export const useWebSockets = (transcriptId: string | null): UseWebSockets => {
const text = textQueue[0];
setTranscriptText(text);
const delay = text.length * 100;
const WPM_READING = 200; // words per minute to read
const wordCount = text.split(/\s+/).length;
const delay = (wordCount / WPM_READING) * 60 * 1000;
setTimeout(() => {
setIsProcessing(false);
setTextQueue((prevQueue) => prevQueue.slice(1));