title: AudioContext

sidebar_label: AudioContext

The AudioContext instance can be obtained through Taro.createAudioContext. AudioContext is bound to an audio component with an id, to work with the audio component.

Reference

Methods

pause

Pauses the audio playback.

Reference

  1. () => void

API Support

API WeChat Mini-Program H5 React Native
AudioContext.pause ✔️

play

Plays an audio file.

Reference

  1. () => void

API Support

API WeChat Mini-Program H5 React Native
AudioContext.play ✔️

seek

Jumps to the specific position in the audio file.

Reference

  1. (position: number) => void
Property Type Description
position number The position where the playback will jump to in the audio file (in sec).

API Support

API WeChat Mini-Program H5 React Native
AudioContext.seek ✔️

setSrc

Sets an audio file address.

Reference

  1. (src: string) => void
Property Type Description
src string Audio file address

API Support

API WeChat Mini-Program H5 React Native
AudioContext.setSrc ✔️

API Support

API WeChat Mini-Program H5 React Native
AudioContext.pause ✔️
AudioContext.play ✔️
AudioContext.seek ✔️
AudioContext.setSrc ✔️