title: Taro.createAudioContext(id, component)
sidebar_label: createAudioContext
Creates the AudioContext object for the audio.
Note:As of base library 1.6.0, this API is not maintained. Use Taro.createInnerAudioContext instead
Type
(id: string, component?: Record<string, any>) => AudioContext
Parameters
Property | Type | Description |
---|---|---|
id | string |
The audio component’s ID |
component | Record<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
API | WeChat Mini-Program | H5 | React Native |
---|---|---|---|
Taro.createAudioContext | ✔️ |