收藏
回答

录音无法播放

框架类型 问题类型 操作系统 操作系统版本 手机型号 微信版本
小程序 Bug iOS ios iphone7 6.5

- 当前 Bug 的表现(可附上截图)


- 预期表现

playRecode11: function () {

//const innerAudioContext = wx.createInnerAudioContext();

let that = this;

innerAudioContext.autoplay = true;

innerAudioContext.obeyMuteSwitch = false;

innerAudioContext.onPlay(() => {

console.log('开始播放')

})

innerAudioContext.onError((res) => {

// 播放音频失败的回调

console.log(res)

})

innerAudioContext.onTimeUpdate((res) => {

const currentTime = innerAudioContext.currentTime;

this.setData({

currentTime: this._formatTime(currentTime),

percent: currentTime / this.data.currentSong.duration

})

console.log(currentTime / this.data.currentSong.duration);

if (this.data.currentLyric) {

this.handleLyric(currentTime * 1000)

}

})


innerAudioContext.onEnded((res) => {

console.log("innerAudioContext播放完成");

this.setData({

b_img: "../../images/c_musice/bf.png",

b_type: "1",

currentTime: this.data.duration,

percent: 1


})


console.log("innerAudioContext currentTime" + that.data.percent)

})


innerAudioContext.src = this.data.recodePath; // 这里可以是录音的临时路径

console.log("录音路径:" + this.data.recodePath)

//innerAudioContext.play();


if (that.data.b_type == "1") {

innerAudioContext.play()

that.setData({

b_img: "../../images/c_musice/zt.png",

b_type: "2"

})

} else {

innerAudioContext.pause()

that.setData({

b_img: "../../images/c_musice/bf.png",

b_type: "1"

})

}

},

- 复现路径


- 提供一个最简复现 Demo


回答关注问题邀请回答
收藏

2 个回答

  • 木易子
    木易子
    2018-09-20

    都正常,就是不出声音,

    innerAudioContext.onTimeUpdate((res) => {

    const currentTime = innerAudioContext.currentTime;

    this.setData({

    currentTime: this._formatTime(currentTime),

    percent: currentTime / this.data.currentSong.duration

    })

    console.log(currentTime / this.data.currentSong.duration);

    if (this.data.currentLyric) {

    this.handleLyric(currentTime * 1000)

    }

    })

    这个都能打印出时间

    2018-09-20
    有用
    回复
  • 疯狂的小辣椒
    疯狂的小辣椒
    2018-09-20

    你好,打印失败的回调没有信息提示的吗?

    2018-09-20
    有用
    回复 7
    查看更多(2)
登录 后发表内容