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
Copy file name to clipboardExpand all lines: docs/README.md
+50-34Lines changed: 50 additions & 34 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -87,6 +87,7 @@ mutex | true | prevent to play multiple player at the same time, pause other pla
87
87
lrcType | 0 | [see more details](https://aplayer.js.org/#/home?id=lrc)
88
88
listFolded | false | indicate whether list should folded at first
89
89
listMaxHeight | - | list max height
90
+
storageName | 'aplayer-setting' | localStorage key that store player setting
90
91
91
92
For example:
92
93
@@ -147,56 +148,64 @@ const ap = new APlayer({
147
148
148
149
+`ap.on(event: string, handler: function)`: bind audio and player events, [see more details](https://aplayer.js.org/#/home?id=event-binding)
149
150
150
-
+`ap.switchAudio(index: number)`: switch audio list
151
+
+`ap.volume(percentage: number, nostorage: boolean)`: set audio volume
151
152
152
153
```js
153
-
ap.switchAudio(1);
154
+
ap.volume(0.1, true);
154
155
```
155
156
156
-
+`ap.addAudio(audio)`: add new audios to the list
157
+
+`ap.theme(color: string, index: number)`: set player theme, the default of index is current audio index
157
158
158
159
```js
159
-
ap.addAudio([
160
-
{
161
-
name:'name',
162
-
artist:'artist',
163
-
url:'url.mp3',
164
-
cover:'cover.jpg',
165
-
lrc:'lrc.lrc',
166
-
theme:'#ebd0c2'
167
-
}
168
-
]);
160
+
ap.theme('#000', 0);
169
161
```
170
162
171
-
+`ap.removeAudio(index: number)`: remove audio from the list
163
+
+`ap.setMode(mode: string)`: set player mode, the value of mode should be 'mini' or 'normal'
172
164
173
-
```js
174
-
ap.removeAudio(1);
175
-
```
165
+
+`ap.mode`: return current player mode, 'mini' or 'normal'
176
166
177
-
+`ap.volume(percentage: number, nostorage: boolean)`: set audio volume
167
+
+`ap.notice(text: string, time: number, opacity: number)`: show message, the unit of time is millisecond, the default of time is 2000, the default of opacity is 0.8, setting time to 0 can disable notice autohide.
178
168
179
169
```js
180
-
ap.volume(0.1, true);
170
+
ap.notice('Amazing player', 2000, 0.8);
181
171
```
182
172
183
-
+`ap.theme(color: string, index: number)`: set player theme, the default of index is current audio index
173
+
+`ap.destroy()`: destroy player
174
+
175
+
+`ap.list`
176
+
177
+
+`ap.list.show()`: show list
178
+
179
+
+`ap.list.hide()`: hide list
180
+
181
+
+`ap.list.toggle()`: toggle list between show and hide
182
+
183
+
+`ap.list.add(audios: array | object)`: add new audios to the list
184
184
185
185
```js
186
-
ap.theme('#000', 0);
186
+
ap.list.add([{
187
+
name:'name',
188
+
artist:'artist',
189
+
url:'url.mp3',
190
+
cover:'cover.jpg',
191
+
lrc:'lrc.lrc',
192
+
theme:'#ebd0c2'
193
+
}]);
187
194
```
188
195
189
-
+`ap.setMode(mode: string)`: set player mode, the value of mode should be 'mini' or 'normal'
196
+
+`ap.list.remove(index: number)`: remove an audio from the list
190
197
191
-
+`ap.mode`: return current player mode, 'mini' or 'normal'
198
+
```js
199
+
ap.list.remove(1);
200
+
```
192
201
193
-
+`ap.notice(text: string, time: number, opacity: number)`: show message, the unit of time is millisecond, the default of time is 2000, the default of opacity is 0.8, setting time to 0 can disable notice autohide.
202
+
+`ap.list.switch()`: switch to an audio in the list
194
203
195
204
```js
196
-
ap.notice('Amazing player', 2000, 0.8);
205
+
ap.list.switch(1);
197
206
```
198
207
199
-
+`ap.destroy()`: destroy player
208
+
+`ap.list.clear()`: remove all audios from the list
0 commit comments