Taro.createInnerAudioContext()
创建内部 audio 上下文 InnerAudioContext 对象。
支持情况:
类型
() => InnerAudioContext
示例代码
const innerAudioContext = Taro.createInnerAudioContext()
innerAudioContext.autoplay = true
innerAudioContext.src = 'https://storage.360buyimg.com/jdrd-blog/27.mp3'
innerAudioContext.onPlay(() => {
console.log('开始播放')
})
innerAudioContext.onError((res) => {
console.log(res.errMsg)
console.log(res.errCode)
})