You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Props are almost the same with original APlayer, please check the [docs](https://aplayer.js.org/docs/#/) for more details.
57
-
58
-
| Name | Type | Required | Default | Description |
59
-
|---|---|---|---|---|
60
-
|autoplay| Boolean | N |`false`||
61
-
|listmaxheight| String | N | N/A |e.g. `'80px'`|
62
-
|mode| String ||`'circulation'`|One of `'circulation'`, `'order'`, `'random'`, `'single'`|
63
-
|mute| Boolean ||`false`||
64
-
|narrow| Boolean ||`false`||
65
-
|preload| String ||`'auto'`|One of `'auto'`, `'metadata'`, `'none'`|
66
-
|showlrc| Number ||`0`||
67
-
|theme| String ||`'#b7daff'`||
68
-
|music| Array \| Object | Y | N/A ||
69
-
|music.url| String | Y |||
70
-
|music.title| String || N/A ||
71
-
|music.author| String || N/A ||
72
-
|music.pic| String || N/A ||
73
-
|music.lrc| String || N/A ||
78
+
**`onInit`** as a callback function will be invoked when aplayer instance get initialized and with the instance as parameter, through which you can get the full control of aplayer API. *see `onInit` in above example*
74
79
75
-
### Event Handlers
76
-
Event handlers are triggered when corresponding event happens, it takes a callback function as param.
80
+
Other props are exactly the same with original APlayer, please check the [docs](https://aplayer.js.org/#/home) for more details.
77
81
78
-
|Name|Type | Description |
79
-
|---|---|---|
80
-
|onPlay| Func ||
81
-
|onCanplay| Func ||
82
-
|onPlay| Func ||
83
-
|onPause| Func ||
84
-
|onPlaying| Func ||
85
-
|onEnded| Func ||
86
-
|onError| Func ||
82
+
### Event Handlers
83
+
Event handlers are triggered when corresponding event happens, it takes a callback function as parameter.
87
84
88
-
### APlayer Instance & Bind Methods
89
-
APlayer Instance can be accessed through `.state.control`.
85
+
All the event handlers in `react-aplayer` are in a format of captalized event name prefixed with `on`, e.g. in aplayer, event `play` will be `onPlay` in react-aplayer,
90
86
91
-
```
92
-
<ReactAplayer {...props} ref={(ap) => {
93
-
const aplayer = ap.state.control;
94
-
}/>
95
-
```
87
+
Please check the [docs](https://aplayer.js.org/#/home?id=event-binding) for more events.
96
88
97
-
To expose APlayer methods on React level, binding is needed.
0 commit comments