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
4 回复