个人案例
太空人时钟
闲置手机变身桌面时钟
太空人时钟扫码体验
10月份测试的时候运行都是正常的,现在不行了。该问题主要表现在mac、window电脑端上无论开发工具还是桌面端微信都无法播放。唯独手机真机能播放。
getBackgroundAudioManager 无法播放 m3u8 音频getBackgroundAudioManager不能播放m3u8音频了么?那文档里的协议设置是摆设么?https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.html [图片] 代码片段:https://developers.weixin.qq.com/s/a3AR4gmp8m5J [图片]
星期二 17:10真机应该application/octet-stream,开发者工具是video/webm。
微信wx.getRecorderManager方法设置音频格式为pcm,原始格式还是webm格式?startRecording() { const _this = this; if (_this.isRecording) { _this.recorderManager.stop(); } else { _this.onWebSocketHandle(); _this.recorderManager = Taro.getRecorderManager(); _this.recorderManager.onStart(() => { console.log("recorder start"); _this.isRecording = true; }); _this.recorderManager.onPause(() => { console.log("recorder pause"); }); _this.recorderManager.onStop((res) => { console.log("recorder stop", res); const { tempFilePath, fileSize } = res; _this.isRecording = false; // _this.sendAudioStream(tempFilePath, fileSize); _this.$emit("stopRecorePushList", { audioBlob: tempFilePath, }) }); _this.recorderManager.onFrameRecorded((res) => { console.log("recorder onFrameRecorded", res); const { frameBuffer, isLastFrame } = res; console.log( "frameBuffer", frameBuffer, "frameBuffer.byteLength", frameBuffer.byteLength, isLastFrame ); _this.sendWebsocketHandle(frameBuffer, isLastFrame); }); const options = { duration: 60000, sampleRate: 48000, numberOfChannels: 1, encodeBitRate: 64000 , format: "pcm", frameSize: 3, }; _this.recorderManager.start(options); } },sendWebsocketHandle(frameBuffer, isLastFrame) { // // 将 ArrayBuffer 转换为 Int16Array(小端序) // const int16Array = new Int16Array(frameBuffer); // // 转换为小端序的 ByteBuffer(模拟 Java 的 ByteBuffer) // const byteBuffer = new ArrayBuffer(int16Array.length * 2); // const dataView = new DataView(byteBuffer); // for (let i = 0; i < int16Array.length; i++) { // dataView.setInt16(i * 2, int16Array[i], true); // true 表示小端序 // } const uint8Array = new Uint8Array(frameBuffer); console.log('uint8Array', uint8Array); console.log('frameBuffer', frameBuffer); // 发送数据(通过 WebSocket) this.socketTask.send({ data: frameBuffer, binary: true }); if (isLastFrame) { this.sendWebsocketEndHandle(); } }, 我需要格式为pcm格式的音频流。生成音频文件下载下来使用FFmpeg查看还是webm格式
10-31该方案已有解决办法,请查收:https://developers.weixin.qq.com/community/develop/article/doc/000c08658900a054e5142ca2169c13
webAudio 播放 audioBuffer 的二进制流文件,吱吱的声音 ?[图片] 音频文件也是通过 webSocket 传送的 pcm 格式的 arrayBuffer , 毫秒级传送很多的流文件, 每个文件都很小,在播放的时候就会有滋滋的声音 async playNextAudioBuffer() { if (this.audioQueue.length === 0) { this.isPlaying = false; this.playIndex = 0; this.isStopAudio = true this.audioStop() return; } this.isPlaying = true; this.playIndex++; if(this.playIndex == 1){ this.timeUpdate() this.haveAiTalkData() } let audioBuffer = this.audioQueue.shift(); this.audioBufferSource = this.audioContext.createBufferSource(); this.audioBufferSource.buffer = audioBuffer; // 连接到扬声器 this.audioBufferSource.connect(this.audioContext.destination); this.audioBufferSource.onended = () => { this.playNextAudioBuffer(); }; // 开始播放 this.audioBufferSource.start(); } 这里有一个很长的 audioBuffer 队列, 当一个 audioBuffer 播放完去播下一个的时候, 会有 吱吱 声音, 使用的腾讯云的实时语音合成
10-31用webAudio,参考:https://developers.weixin.qq.com/community/develop/article/doc/000c08658900a054e5142ca2169c13
请问小程序接收后台音频流式输出 如何解决卡顿问题?小程序接收TTS流式返回的音频 无法像web端通过MediaSource拼接在一起 只能一个一个播放 播放间隙会卡顿 请问怎么解决
10-23我有一计:https://developers.weixin.qq.com/community/develop/article/doc/00028e8c0a0368192214eb4356d013
微信小程序如何播放tts生成的流式音频文件?做一个项目,需要在小程序中播放tts生成的音频流文件,先下载后再播放的方式是可以的,但是下载文件需要太长的时间,用户体验不好,是否有直接播放音频流的方法?
10-23看这里:https://developers.weixin.qq.com/community/develop/article/doc/000c08658900a054e5142ca2169c13
微信小程序接收tts PCM格式的音频流,如何并进行流式播放?微信小程序 通过socket实时接收PCM音频流,但是小程序不支持播放PCM格式的音频,如何实现边收边播放?
10-23我已实现该功能:https://developers.weixin.qq.com/community/develop/article/doc/000c08658900a054e5142ca2169c13
微信小程序可以直接播放字节流吗?在后端对大模型返回的数据进行了tts后返回的byte[]音频数据,在微信小程序上可以直接使用这些数据吗?还是说要保存成临时文件?
10-23看这个 https://developers.weixin.qq.com/community/develop/article/doc/00028e8c0a0368192214eb4356d013
TTS(语音合成)接口,如何实现网页文章朗读?如何利用TTS(语音合成)接口实现黏贴文章地址,打开朗读。 [图片]
10-23这么多年,终于有解决方案了: https://developers.weixin.qq.com/community/develop/article/doc/00028e8c0a0368192214eb4356d013
微信小程序中的TTS如何实现流式播放的?目前在做微信小程序的demo,发现微信小程序关于语音的api只能通过音频地址播放,这样的话就需要合成好以后才能播放,对于大量的文本,会大大增加等待时间,想问一下,在小程序中,tts的流式播放是如何实现的,或者有什么其他办法,可以一边播放,一边合成
10-23利用WebAudioContext的scriptProcessor监听onaudioprocess可以实现。亲测有效。
微信小程序如何实现流式语音实时播报,对接科大讯飞或者阿里、腾讯的流式语音https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.createWebAudioContext.html
10-22