Skip to main content
Version: 3.x

Taro.createInnerAudioContext()

创建内部 audio 上下文 InnerAudioContext 对象。

参考文档

类型#

() => InnerAudioContext

参数#

示例代码#

const innerAudioContext = Taro.createInnerAudioContext()
innerAudioContext.autoplay = true
innerAudioContext.src = 'http://storage.360buyimg.com/jdrd-blog/27.mp3'
innerAudioContext.onPlay(() => {
console.log('开始播放')
})
innerAudioContext.onError((res) => {
console.log(res.errMsg)
console.log(res.errCode)
})

API 支持度#

API微信小程序H5React Native
Taro.createInnerAudioContext✔️✔️✔️