最新版本的开发工具
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框然后再播放音频,这个怎么能让音频最先执行呢,有什么办法吗?
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
})
}
毕竟是网络嘛,得加载一会儿