From 4c776127a96c02c75da8953c68deff8978ee0946 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CNaeel=E2=80=9D?= Date: Sat, 23 May 2026 07:16:10 +0400 Subject: [PATCH] =?UTF-8?q?v88:=20async=20onopen=20+=2010ms=20=D0=B7=D0=B0?= =?UTF-8?q?=D0=B4=D0=B5=D1=80=D0=B6=D0=BA=D0=B0=20=D0=BC=D0=B5=D0=B6=D0=B4?= =?UTF-8?q?=D1=83=20=D1=87=D0=B0=D0=BD=D0=BA=D0=B0=D0=BC=D0=B8=20=E2=80=94?= =?UTF-8?q?=20=D0=B1=D1=83=D1=84=D0=B5=D1=80=20Chrome?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- js/main.js | 2 +- js/transcribe.js | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/js/main.js b/js/main.js index b3a4a57..fe68feb 100644 --- a/js/main.js +++ b/js/main.js @@ -1,6 +1,6 @@ // ---------- Глобальные переменные и инициализация ---------- const GROQ_API_KEY = ''; -const VERSION = 'v87'; +const VERSION = 'v88'; let mediaRecorder, audioChunks = [], userAudioBlob = null, ttsText = ''; let isRecording = false, isAnalyzing = false, micAnalyser = null, micAnimId = null; diff --git a/js/transcribe.js b/js/transcribe.js index 0bbd79a..a120f37 100644 --- a/js/transcribe.js +++ b/js/transcribe.js @@ -24,7 +24,7 @@ async function transcribe(blob) { console.log('[WS] timeout'); ws.close(); resolve({ text: '', error: 'timeout' }); }, 60000); - ws.onopen = () => { + ws.onopen = async () => { console.log('[WS] connected, sending ' + total + ' chunks'); for (let i = 0; i < base64.length; i += CHUNK) { ws.send(JSON.stringify({ @@ -34,6 +34,8 @@ async function transcribe(blob) { m: mime, n: total })); + // Даём браузеру протолкнуть буфер — Chrome может терять фреймы без этого + await new Promise(r => setTimeout(r, 10)); } ws.send(JSON.stringify({ c: -1 })); console.log('[WS] all sent');