同问,请问您是怎么解决的
onSocketMessage在模拟器上可以接受到信息,在真机上接收不到信息使用的环信Demo,但是onSocketMessage在模拟器上可以接受到信息,在真机上接收不到信息
2021-01-25我现在也有也一样的问题,体验版,接收不到消息、PC开发者工具可以,您解决了吗
websocket api wx.onsocketmessage接收不到消息?调用搜狗AI开放平台的asr语音识别接口。二进制音频数据已经发送成功,但是接受不到服务器消息。 [图片] const recorder=wx.getRecorderManager() const recordconfig={ frameSize: 25, sampleRate: 16000, format: 'WAV', numberOfChannels: 1 } const app=getApp() openSocket: function(){ wx.connectSocket({ url: 'wss://api.zhiyin.sogou.com/wss/asr/v1/streaming_recognize?Appid=1WCCVjJBLB5GzcRIEepsbmxNdgd&Authorization=Bearer '+wx.getStorageSync('token'), timeout: 600000, success: res=>{ console.log("连接成功") } }) wx.onSocketMessage(res => { console.log(res) }) wx.onSocketOpen((result) => { console.log(result) let config={ "encoding": "LINEAR16", "sample_rate_hertz": 16000, "language_code": "zh-cmn-Hans-CN" } let streamconfig={ "config": config, "interim_results": true } wx.sendSocketMessage({ data: JSON.stringify(streamconfig), success: res=>{ console.log('发送初始帧') } }) recorder.start(recordconfig) recorder.onFrameRecorded(res=>{ wx.sendSocketMessage({ data: wx.arrayBufferToBase64(res.frameBuffer), success: res=>{ console.log('发送数据帧') } }) }) }) }
2021-01-25