本接口仅适用于小游戏试玩,非小游戏标准接口
功能描述
创建上下文 AudioContext 对象。
返回值
示例代码
这里需要特别注意,音频 src 不能使用网络链接,只能使用包内文件。
const innerAudioContext = wx.createInnerAudioContext()
innerAudioContext.src = 'audio/bgm.mp3'; // 必须是包内文件
innerAudioContext.play() // 播放
最后一次编辑于 2026-04-09
本接口仅适用于小游戏试玩,非小游戏标准接口
创建上下文 AudioContext 对象。
这里需要特别注意,音频 src 不能使用网络链接,只能使用包内文件。
const innerAudioContext = wx.createInnerAudioContext()
innerAudioContext.src = 'audio/bgm.mp3'; // 必须是包内文件
innerAudioContext.play() // 播放