我现在也遇到了同样的问题,不知道该问题是否已有解决方案?
Android 系统下无法通过蓝牙耳机录音(iOS可以)手机连接蓝牙耳机(蓝牙耳机能正常SCO通话)的情况下,在iOS上小程序调用录音API时可以从蓝牙耳机录音,但是同样的小程序在Android平台上录音不能从蓝牙耳机录音。以下是代码片段 [代码]capture: [代码][代码]function[代码] [代码]() {[代码][代码] [代码][代码]const recorderManager = wx.getRecorderManager()[代码][代码] [代码][代码]recorderManager.onStart(() => {[代码][代码] [代码][代码]console.log([代码][代码]'recorder start'[代码][代码])[代码][代码] [代码][代码]})[代码][代码] [代码][代码]recorderManager.onResume(() => {[代码][代码] [代码][代码]console.log([代码][代码]'recorder resume'[代码][代码])[代码][代码] [代码][代码]})[代码][代码] [代码][代码]recorderManager.onPause(() => {[代码][代码] [代码][代码]console.log([代码][代码]'recorder pause'[代码][代码])[代码][代码] [代码][代码]})[代码][代码] [代码][代码]recorderManager.onStop((res) => {[代码][代码] [代码][代码]console.log([代码][代码]'recorder stop'[代码][代码], res)[代码][代码] [代码][代码]const { tempFilePath } = res[代码][代码] [代码][代码]this[代码][代码].setData([代码][代码] [代码][代码]{ recordFile: tempFilePath}[代码][代码] [代码][代码])[代码][代码] [代码][代码]console.log([代码][代码]'开始播放 tempFilePath '[代码] [代码]+ tempFilePath)[代码][代码] [代码][代码]})[代码][代码] [代码][代码]recorderManager.onFrameRecorded((res) => {[代码][代码] [代码][代码]const { frameBuffer } = res[代码][代码] [代码][代码]console.log([代码][代码]'frameBuffer.byteLength'[代码][代码], frameBuffer.byteLength)[代码][代码] [代码][代码]})[代码][代码] [代码][代码]const options = {[代码][代码] [代码][代码]duration: 3000,[代码][代码] [代码][代码]sampleRate: 44100,[代码][代码] [代码][代码]numberOfChannels: 1,[代码][代码] [代码][代码]encodeBitRate: 192000,[代码][代码] [代码][代码]format: [代码][代码]'mp3'[代码][代码],[代码][代码] [代码][代码]frameSize: 50[代码][代码] [代码][代码]}[代码][代码] [代码][代码]recorderManager.start(options)[代码][代码]},[代码] 更新: 代码片段wechatide://minicode/a33BgPmF6QZB
2020-03-05