WeChat applet audio component control


wx.createAudioContext(audioId)

Create and return audio contextaudioContext Object

audioContext

audioContext Pass audioId Bind to an audio component, through which you can operate an audio component.

Method list of audioContext object:

QQ截图20170208110925.png

##Sample code:

<!-- audio.wxml -->
<audio  src="{{src}}" id="myAudio" ></audio>

<button type="primary" bindtap="audioPlay">播放</button>
<button type="primary" bindtap="audioPause">暂停</button>
<button type="primary" bindtap="audio14">设置当前播放时间为14秒</button>
<button type="primary" bindtap="audioStart">回到开头</button>
rrree