Committed by
GitHub
fix wasm app for streaming paraformer (#1328)
正在显示
1 个修改的文件
包含
10 行增加
和
0 行删除
| @@ -108,8 +108,18 @@ if (navigator.mediaDevices.getUserMedia) { | @@ -108,8 +108,18 @@ if (navigator.mediaDevices.getUserMedia) { | ||
| 108 | } | 108 | } |
| 109 | 109 | ||
| 110 | let isEndpoint = recognizer.isEndpoint(recognizer_stream); | 110 | let isEndpoint = recognizer.isEndpoint(recognizer_stream); |
| 111 | + | ||
| 111 | let result = recognizer.getResult(recognizer_stream).text; | 112 | let result = recognizer.getResult(recognizer_stream).text; |
| 112 | 113 | ||
| 114 | + if (recognizer.config.modelConfig.paraformer.encoder != '') { | ||
| 115 | + let tailPaddings = new Float32Array(expectedSampleRate); | ||
| 116 | + recognizer_stream.acceptWaveform(expectedSampleRate, tailPaddings); | ||
| 117 | + while (recognizer.isReady(recognizer_stream)) { | ||
| 118 | + recognizer.decode(recognizer_stream); | ||
| 119 | + } | ||
| 120 | + result = recognizer.getResult(recognizer_stream).text; | ||
| 121 | + } | ||
| 122 | + | ||
| 113 | 123 | ||
| 114 | if (result.length > 0 && lastResult != result) { | 124 | if (result.length > 0 && lastResult != result) { |
| 115 | lastResult = result; | 125 | lastResult = result; |
-
请 注册 或 登录 后发表评论