播放网络音频有有延迟?
发布于 7 年前 作者 gongjuan 9445 次浏览 来自 官方Issues

最新版本的开发工具

innerAudioContext.src = http://downsc.chinaz.net/Files/DownLoad/sound1/201808/10544.wav

innerAudioContext.play();

innerAudioContext.onError((res) => {

console.log(res.errMsg)

console.log(res.errCode)

})

wx.showToast({

title: ‘xxxxxxxxxxx’,

image: ‘xxxxxxx’,

duration: 4000

})

会先弹出Toast框然后再播放音频,这个怎么能让音频最先执行呢,有什么办法吗?

3 回复

毕竟是网络嘛,得加载一会儿

const innerAudioContext = wx.createInnerAudioContext()

innerAudioContext.src = https://www.xyvoicewx.cn/xypyhtzcl/./files/video/地产-京华新天地.mp3

innerAudioContext.autoplay = true

innerAudioContext.onTimeUpdate(() => {

const duration = innerAudioContext.duration;

let currentTime = innerAudioContext.currentTime;

let slidervalue = 0;

slidervalue = Math.round((currentTime / duration) * 100);

if(slidervalue == 5){

wx.showToast({

title: ‘xxxxxxxxxxx’,

image: ‘xxxxxxx’,

duration: 4000

})

}

回到顶部