# audio
From the base library 1.6.0 Start, this interface is out of maintenance, please use the wx.createInnerAudioContext replace
Start from base library version 1.0.0. Please remaining backward compatible.
Relevant api: wx.createAudioContext
# Functional description
Audio.
# Property Dxplaination
attribute | type | Default value | Required | Introductions | Minimum version |
---|---|---|---|---|---|
id | string | no | audio The unique identifier of the component | 1.0.0 | |
src | string | no | Address of the resource to play audio | 1.0.0 | |
loop | boolean | false | no | Does it loop? | 1.0.0 |
controls | boolean | false | no | Whether to display default controls | 1.0.0 |
poster | string | no | The image resource address of the audio cover on the default control if the controls The property value is false Set the poster invalid | 1.0.0 | |
name | string | Unknown Audio | no | The audio name on the default control if the controls The property value is false Set the name invalid | 1.0.0 |
author | string | Unknown author | no | The author name on the default control if the controls The property value is false Set the author invalid | 1.0.0 |
binderror | eventhandle | no | Trigger when an error occurs error Event, detail = {errMsg:MediaError.code} | 1.0.0 | |
bindplay | eventhandle | no | When the beginning/Trigger the play event while continuing to play | 1.0.0 | |
bindpause | eventhandle | no | Triggered when pausing playback pause event | 1.0.0 | |
bindtimeupdate | eventhandle | no | Triggered when the playback schedule changes timeupdate Event, detail = {currentTime, duration} | 1.0.0 | |
bindended | eventhandle | no | Triggered when playing to the end ended event | 1.0.0 |
# MediaError.code
Return error code | describe |
---|---|
1 | Access to the resource is forbidden by the user |
2 | Network error |
3 | Decoding error |
4 | Inappropriate resources |