通过wx.startRecord录制的音频的问题
发布于 5 年前 作者 xiulanshen 6870 次浏览 来自 问答

通过wx.startRecord录制的音频,记录下path后,通过wx.playVoice可以播放。

但是,将论文件上传至服务器后,在其他界面下载下来却播放不了,出现如下错误?请问应该如何处理?thanks!

其他界面播放代码如下:

this.audioCtx = wx.createInnerAudioContext();

 playRecord: function(t) {

    console.log(“playRecord:” +JSON.stringify(t));

    const audioSource = ‘http://…’ + t.currentTarget.dataset.src;

    console.log(‘audioSource:’ + audioSource);

    this.audioCtx.autoplay = true;

    this.startTime = 0;

    this.audioCtx.src = audioSource;

    this.audioCtx.play();

    this.audioCtx.onPlay(() => {

      console.log(‘开始播放’);

    })

    this.audioCtx.onError((res) => {

      console.log(res.errMsg);

      console.log(res.errCode);

    })

  },

报如下错误:

2 回复

给个代码片段?

问题找到了,

__录音生成的默认都是silk格式,但是__wx.createInnerAudioContext不支持silk格式

回到顶部