fix: phoneticAnalysis timeout 15s — защита от зависания decodeAudioData (Chrome bug, длинные WebM)
This commit is contained in:
+4
-1
@@ -223,9 +223,12 @@ async function doCompare(blob, originalText, duration) {
|
||||
}, 150);
|
||||
let whisperResult, phon;
|
||||
try {
|
||||
const phonTimeout = new Promise(resolve =>
|
||||
setTimeout(() => resolve({ pitchHz: 0, pitchStability: 0, voiceClarity: 0, phonScore: 0 }), 15000)
|
||||
);
|
||||
[whisperResult, phon] = await Promise.all([
|
||||
transcribe(blob),
|
||||
phoneticAnalysis(blob)
|
||||
Promise.race([phoneticAnalysis(blob), phonTimeout])
|
||||
]);
|
||||
} catch(e) {
|
||||
clearInterval(timerId);
|
||||
|
||||
Reference in New Issue
Block a user