Skip to content

Commit eeef9b4

Browse files
committed
default options
1 parent 7cb233e commit eeef9b4

8 files changed

Lines changed: 55 additions & 20 deletions

File tree

README.md

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ npm install aplayer
2424

2525
## Usage
2626

27-
### The following HTML structure is used for APlayer:
27+
### HTML:
2828

2929
```
3030
<link rel="stylesheet" href="APlayer.css">
@@ -36,7 +36,7 @@ npm install aplayer
3636
<script src="APlayer.js"></script>
3737
```
3838

39-
### And this is how the APlayer is initialized:
39+
### JS:
4040

4141
```
4242
var ap = new APlayer({
@@ -54,6 +54,23 @@ var ap = new APlayer({
5454
ap.init();
5555
```
5656

57+
### JS Initialized Options
58+
59+
```
60+
{
61+
element: document.getElementById('player1'), // Optional, player element
62+
narrow: false, // Optional, narrow style
63+
autoplay: true, // Optional, autoplay
64+
showlrc: false, // Optional, show lrc
65+
music: { // Required, musci info
66+
title: 'Preparation', // Required, music title
67+
author: 'Hans Zimmer/Richard Harvey', // Required, music author
68+
url: 'http://7xifn9.com1.z0.glb.clouddn.com/Preparation.mp3', // Required, music url
69+
pic: 'http://7xifn9.com1.z0.glb.clouddn.com/Preparation.jpg' // Required, music picture
70+
}
71+
}
72+
```
73+
5774
### With lrc
5875

5976
Using [LRC format](https://en.wikipedia.org/wiki/LRC_(file_format))
@@ -87,10 +104,11 @@ HTML:
87104

88105
JS:
89106

90-
Init Option: `showlrc: false`
107+
Initialized Option: `showlrc: false`
91108

92109
### API
93110

111+
+ `ap.init()`
94112
+ `ap.play()`
95113
+ `ap.pause()`
96114

@@ -107,9 +125,10 @@ gulp
107125
- [x] 分享到微博
108126
- [x] 加载样式及错误处理
109127
- [x] 窄样式 及 移动版样式
128+
- [x] 歌词展示
129+
- [x] 默认选项
110130
- [ ] 移动端兼容性
111131
- [ ] 播放列表
112-
- [ ] 歌词展示
113132
- [ ] 宽度高度自定义
114133

115134
## Issues

demo/index.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ <h3>Narrow style</h3>
137137
element: document.getElementById('player1'),
138138
narrow: false,
139139
autoplay: false,
140+
showlrc: false,
140141
music: {
141142
title: 'Preparation',
142143
author: 'Hans Zimmer/Richard Harvey',
@@ -149,6 +150,7 @@ <h3>Narrow style</h3>
149150
element: document.getElementById('player2'),
150151
narrow: true,
151152
autoplay: false,
153+
showlrc: false,
152154
music: {
153155
title: 'Preparation',
154156
author: 'Hans Zimmer/Richard Harvey',

dist/APlayer.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)