fix wasm app for streaming paraformer (#1328)
This commit is contained in:
@@ -108,8 +108,18 @@ if (navigator.mediaDevices.getUserMedia) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let isEndpoint = recognizer.isEndpoint(recognizer_stream);
|
let isEndpoint = recognizer.isEndpoint(recognizer_stream);
|
||||||
|
|
||||||
let result = recognizer.getResult(recognizer_stream).text;
|
let result = recognizer.getResult(recognizer_stream).text;
|
||||||
|
|
||||||
|
if (recognizer.config.modelConfig.paraformer.encoder != '') {
|
||||||
|
let tailPaddings = new Float32Array(expectedSampleRate);
|
||||||
|
recognizer_stream.acceptWaveform(expectedSampleRate, tailPaddings);
|
||||||
|
while (recognizer.isReady(recognizer_stream)) {
|
||||||
|
recognizer.decode(recognizer_stream);
|
||||||
|
}
|
||||||
|
result = recognizer.getResult(recognizer_stream).text;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (result.length > 0 && lastResult != result) {
|
if (result.length > 0 && lastResult != result) {
|
||||||
lastResult = result;
|
lastResult = result;
|
||||||
|
|||||||
Reference in New Issue
Block a user