Open jiangyanghe opened 1 year ago
显示“[19:45.063 Recorder:1]结束录音失败:未开始录音”, 但是录音是正常的, this.recorder.open 也可以正常打印
this.recorder = Recorder({ type: this.type || 'wav', // wav格式, 需要使用的type类型,需提前把格式支持文件加载进来 bitRate: this.bitRate || 36, // 比特率kbps,越大音质越好 sampleRate: this.sampleRate || 18000, // 采样率hz,每秒音波震动次数,越大细节越丰富 onProcess(buffers, powerLevel, duration, sampleRate) { buffers, // [[Int16,...],...]:缓冲的PCM数据,为从开始录音到现在的所有pcm片段,每次回调可能增加0-n个不定量的pcm片段 powerLevel, // 输入的音频波动值0-100 duration, // 录音持续时间ms sampleRate; }, // 录音实时回调,大约1秒调用12次回调 }); this.recorder.open(() => { console.log('打开成功:', this.recorder); this.recorder.start(); // 渲染音频波形图 // This.wave = Recorder.WaveView({ elem: '.ctrlProcessWave' }); }, (msg, isUserNotAllow) => { // 浏览器不支持录音、用户拒绝麦克风权限、或者非安全环境(非https、file等 console.log(`${isUserNotAllow ? 'UserNotAllow,' : ''}无法录音:${msg}`); });
日志 贴全一点看看
显示“[19:45.063 Recorder:1]结束录音失败:未开始录音”, 但是录音是正常的, this.recorder.open 也可以正常打印