Skip to main content
Version: Next

Taro.createAudioContext(id, component)

Creates the AudioContext object for the audio.

Note:As of base library 1.6.0, this API is not maintained. Use Taro.createInnerAudioContext instead

Reference

Type

(id: string, component?: Record<string, any>) => AudioContext

Parameters

PropertyTypeDescription
idstringThe audio component's ID
componentRecord<string, any>The this object of the current component instance in custom components. It is used with the audio component

Sample Code

const audioCtx = Taro.createAudioContext('myAudio')

API Support

APIWeChat Mini-ProgramH5React Native
Taro.createAudioContext✔️