feat: 添加音频录制模块及示例,支持纯JavaScript环境
This commit is contained in:
@@ -50,10 +50,10 @@ export class Relatime {
|
||||
const voice = data.toString('base64');
|
||||
this.asr.ws.send(JSON.stringify({ voice }));
|
||||
}
|
||||
sendBase64(data: string) {
|
||||
sendBase64(data: string, opts?: { isRelatime?: boolean }) {
|
||||
if (!this.ready) return;
|
||||
console.log('send 花费时间:', Date.now() - this.startTime);
|
||||
this.asr.ws.send(JSON.stringify({ voice: data, format: 'float32', time: Date.now() }));
|
||||
this.asr.ws.send(JSON.stringify({ voice: data, format: 'float32', time: Date.now(), ...opts }));
|
||||
// if (this.timeoutHandle) {
|
||||
// clearTimeout(this.timeoutHandle);
|
||||
// }
|
||||
|
||||
Reference in New Issue
Block a user