Open GenieShen opened 3 months ago
日志里面有个编号Recorder:28 | 29
,开头的start 和 stop 并不是同一个rec,你同一时间调用了两次你的startRecorder之类的方法
日志里面有个编号
Recorder:28 | 29
,开头的start 和 stop 并不是同一个rec,你同一时间调用了两次你的startRecorder之类的方法
请问有啥办法能解决吗,我打印日志看是只调了一次startRecorder方法的,(能放我进群吗大佬,申请了好几次没人处理
<div className={
${chatStyle["chat-input-action"]} clickable`} onMouseDown={(e) => startRecorder(e)} onMouseUp={(e) => endRecorder(e)} onTouchStart={(e) => startRecorder(e)} onTouchEnd={(e) => endRecorder(e)}const endRecorder = (e: any) => { // 停止录音 rec.stop( async function (blob: any, duration: any) { // 创建指向音频文件的URL // var audioURL = (window.URL || webkitURL).createObjectURL(blob); // 把MP3文件传输到openai const file = new File([blob], "test.mp3", { type: "audio/mpeg", }); const transcription = await openai.audio.transcriptions.create({ file: file, model: "whisper-1", }); console.log("语音转文字结果:", transcription.text); // 回显在聊天框中 props.setSpeechToText(transcription.text); }, function (msg: any) { console.log(msg); }, function () { // 释放录音资源 rec.close(); rec = null; }, ); };`