API onTimeUpdate 无法起作用

发布于 7 年前作者 wwen14777 次浏览最后编辑 7 年前来自 ask

this.myaudioCtx= wx.createInnerAudioContext()

this.myaudioCtx.src =this.data.tempFilePath
this.myaudioCtx.play()
this.myaudioCtx.onTimeUpdate(() => {
console.log('update')})

有声音出来 但是onTimeUpdate 毫无作用

createInnerAudioContext api createInnerAudioContext 无法触发

5 回复
yang98
yang981 楼6 年前

你好,请提供一下出现问题的机型和微信版本。

xujie
xujie2 楼6 年前

在onTimeUpdate前加一个onPlay方法就可以了,我估计是手动开启监听了

tdai
tdai3 楼6 年前

感谢回复!

今天我又试了一下,手机上可以,但模拟器不行。

还有一个模拟器的bug:audioCtx.currentTime这条API返回的时间单位跟手机上返回的时间的是不一样的,相差了1000倍。

这两条都还好,但是主要的:

手机上的wx.playVoice方法是不能用的,模拟器上反而没问题

试过两台手机都不能放

G920F Samsung 6.5.15

Honor8 Huawei 6.5.19

WXOPEN Club 内容图片
mengping
mengping4 楼6 年前
  1. 时间单位是开发工具上的实现有 bug,我们会尽快修复

  2. 请使用 createInnerAudioContext 接口来播放

wanyan
wanyan5 楼6 年前

4楼神解!!!!!刚开始我把onPlay写了 但是是空的 没想用。。。onTimeUpdate可以使用,但是注释掉onPlay之后 就不执行onTimeUpdate了  不看见4楼,能哭死。!木马