Skip to content

Commit ac302bb

Browse files
committed
Merge branch 'release/1.3.0'
2 parents 40172bd + aae5401 commit ac302bb

13 files changed

+6638
-164
lines changed

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ node_js:
55
script: npm run lint
66

77
cache:
8+
yarn: true
89
directories:
910
- "node_modules"
1011

@@ -18,7 +19,7 @@ deploy:
1819
github-token: $GITHUB_TOKEN # Set in travis-ci.org dashboard, marked secure
1920
keep-history: true
2021
on:
21-
branch: develop
22+
branch: master
2223
local-dir: demo
2324
- provider: npm
2425
skip-cleanup: true

README.md

Lines changed: 22 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,30 @@
1-
# vue-aplayer
2-
[![npm](https://img.shields.io/npm/v/vue-aplayer.svg?style=flat-square)](https://www.npmjs.com/package/vue-aplayer)
3-
[![devDependency Status](https://img.shields.io/david/dev/SevenOutman/vue-aplayer.svg?style=flat-square)](https://david-dm.org/SevenOutman/vue-aplayer#info=devDependencies)
4-
[![npm](https://img.shields.io/npm/dt/vue-aplayer.svg?style=flat-square)](https://www.npmjs.com/package/vue-aplayer)
5-
[![npm](https://img.shields.io/npm/l/vue-aplayer.svg?style=flat-square)](https://github.com/SevenOutman/vue-aplayer/blob/master/LICENSE)
1+
<h1 align="center">Vue-APlayer</h1>
62

7-
Vue implementation of [APlayer](https://github.com/MoePlayer/APlayer) prototype.
3+
> Vue implementation of [APlayer](https://github.com/MoePlayer/APlayer) prototype.
84
[**Demo**](https://sevenoutman.github.io/vue-aplayer)
95

10-
![image](https://i.loli.net/2018/03/13/5aa6bd4562f39.png)
116

12-
## Install
7+
[![Travis](https://img.shields.io/travis/SevenOutman/vue-aplayer.svg?style=flat-square)](https://travis-ci.org/SevenOutman/vue-aplayer)
8+
[![npm](https://img.shields.io/npm/v/vue-aplayer.svg?style=flat-square)](https://www.npmjs.com/package/vue-aplayer)
9+
[![devDependency Status](https://img.shields.io/david/dev/SevenOutman/vue-aplayer.svg?style=flat-square)](https://david-dm.org/SevenOutman/vue-aplayer#info=devDependencies)
10+
[![npm](https://img.shields.io/npm/dt/vue-aplayer.svg?style=flat-square)](https://www.npmjs.com/package/vue-aplayer)
1311

14-
```
15-
$ npm install vue-aplayer --save
16-
```
12+
![vue-aplayer](https://i.loli.net/2018/03/16/5aab3da0746e7.png)
1713

18-
## Requirements
14+
### Features
15+
- Clean and simple UI
16+
- Playlist
17+
- Lyrics scroll
18+
- Custom theme color / Self-adapting theme color
19+
- Mutex play
20+
- HLS support
1921

20-
- Promise
21-
- fetch
22+
Using Vue-APlayer in your project? [Let me know!](https://github.com/SevenOutman/vue-aplayer/issues/26)
2223

2324
## Usage
2425

2526
```HTML
26-
<aplayer autoplay
27+
<aplayer autoplay
2728
:music="{
2829
title: 'Preparation',
2930
author: 'Hans Zimmer/Richard Harvey',
@@ -33,84 +34,18 @@ $ npm install vue-aplayer --save
3334
}"
3435
/>
3536
```
36-
37-
```JS
38-
// ES6
39-
import Aplayer from 'vue-aplayer'
40-
41-
new Vue({
42-
components: {
43-
Aplayer
44-
}
45-
})
46-
```
47-
48-
49-
### Props
50-
51-
Props are mostly the same as [APlayer's options](https://aplayer.js.org/#/home?id=options).
52-
53-
| Name | Type | Default | Description |
54-
| ---- | ---- | ------- | ----------- |
55-
| music| Object | *required* | Music info for current playing music, see [Music info](https://github.com/SevenOutman/vue-aplayer#music-info) |
56-
| list | Array | `[]` | Music list to play and display. If list is not empty, music list panel will be shown, even if the only song in the list is identical to music prop. |
57-
| mini | Boolean | `false` | Mini mode |
58-
| float | Boolean | `false` | Float mode, in which you can drag the player around and leave it anywhere on your page |
59-
| autoplay | Boolean | `false` | Whether to autoplay. If more than one mutex player are set autoplay, only the first one will play. |
60-
| showlrc | Boolean | `false` | Whether to show lyrics or not |
61-
| mutex | Boolean | `true` | Pause other players when this player is playing |
62-
| theme | String | `'#b7daff'` | Theme color |
63-
| mode | String | `'circulation'` | Play mode, can be 'random' 'single 'circulation'(loop) or 'order'(no loop) |
64-
| preload | String | `'auto'` | The way to load music, can be 'none' 'metadata' or 'auto' |
65-
| listMaxHeight | String | *none* | Max height of play list |
66-
| narrow | Boolean | `false` | DEPRECATED, use `mini` instead |
67-
| listmaxheight | String | *none* | DEPRECATED, use `listMaxHeight` instead |
68-
69-
> If you are using Vue@2.3.0+, you can use [`.sync` Modifier](https://vuejs.org/v2/guide/components.html#sync-Modifier) on `music` and `mode` prop.
70-
71-
### Music info
72-
73-
The `music` props can either be an object containing info of the song to play, or an array of such objects.
74-
75-
| Property | Default | Description |
76-
| -------- | ------- | ----------- |
77-
| url | *required* | music url |
78-
| title | `'Untitled'` | music title |
79-
| author | `'Unknown'` | music author |
80-
| pic | *none* | music cover picture |
81-
| lrc | *none* | lrc or url to a .lrc file, see: [LRC](https://aplayer.js.org/#/home?id=lrc) |
82-
83-
> vue-aplayer uses [fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) to load your lrc when it's a url.
84-
> If your browser doesn't support fetch by default, please use polyfills like [isomorphic-fetch](https://github.com/matthew-andrews/isomorphic-fetch).
85-
86-
### Events
87-
88-
| Name | Params | Description |
89-
| ---- | ------ | ----------- |
90-
| play | none | Triggered when APlayer start play |
91-
| pause | none | Triggered when APlayer paused |
92-
| canplay | none | Triggered when enough data is available that APlayer can play |
93-
| playing | none | Triggered periodically when APlayer is playing |
94-
| ended | none | Triggered when APlayer ended playing |
95-
| error | none | Triggered when an error occurs |
96-
97-
### Slots
98-
99-
- `slot="display"`
100-
101-
This slot represents the content displayed on the music info panel, which by default is the lyric scroll.
102-
103-
The component in this slot will receive two props: `currentMusic` and `playStat`.
37+
[**Full documentation**](https://github.com/SevenOutman/vue-aplayer/blob/master/docs)
10438

10539
## Contribute
10640

107-
Feel free to [open an issue](https://github.com/SevenOutman/vue-aplayer/issues) if you find a bug.
41+
Feel free to [open an issue](https://github.com/SevenOutman/vue-aplayer/issues) if you find a bug or have a nice idea.
10842

109-
Feature requests and PRs are welcome.
43+
[PRs are welcome](https://github.com/SevenOutman/vue-aplayer/blob/master/docs/README.md#contribute).
11044

11145
## Thanks
11246
[APlayer](https://github.com/MoePlayer/APlayer), for appearance&api design inspiration and prototyping.
11347

114-
## LICENSE
48+
## License
49+
50+
[MIT Licensed](https://github.com/SevenOutman/vue-aplayer/blob/master/LICENSE). Copyright (c) 2016-present Shenghao "Doma" Lei
11551

116-
MIT Licensed. See [LICENSE](https://github.com/SevenOutman/vue-aplayer/blob/master/LICENSE).

docs/README.md

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44
$ npm install vue-aplayer --save
55
```
66

7+
## Requirements
8+
9+
- Promise
10+
- fetch
11+
712
## Usage
813

914
```HTML
@@ -40,14 +45,15 @@ Props are mostly the same as [APlayer's options](https://aplayer.js.org/#/home?i
4045
| mini | Boolean | `false` | Mini mode |
4146
| float | Boolean | `false` | Float mode, in which you can drag the player around and leave it anywhere on your page |
4247
| autoplay | Boolean | `false` | Whether to autoplay. If more than one mutex player are set autoplay, only the first one will play. |
43-
| showlrc | Boolean | `false` | Whether to show lyrics or not |
44-
| mutex | Boolean | `false` | Pause other players when this player is playing |
48+
| showLrc | Boolean | `false` | Whether to show lyrics or not |
49+
| mutex | Boolean | `true` | Pause other players when this player is playing |
4550
| theme | String | `'#b7daff'` | Theme color, will be overridden by current `music`'s theme if set |
4651
| mode | String | `'circulation'` | Play mode, can be 'random' 'single 'circulation'(loop) or 'order'(no loop) |
4752
| preload | String | `'auto'` | The way to load music, can be 'none' 'metadata' or 'auto' |
4853
| listMaxHeight | String | *none* | Max height of play list |
49-
| narrow | Boolean | `false` | DEPRECATED, use `mini` instead |
50-
| listmaxheight | String | *none* | DEPRECATED, use `listMaxHeight` instead |
54+
| narrow | | | DEPRECATED, use `mini` instead |
55+
| listmaxheight | | | DEPRECATED, use `listMaxHeight` instead |
56+
| showlrc | | | DEPRECATED, use `showLrc` instead |
5157

5258
> If you are using Vue@2.3.0+, you can use [`.sync` Modifier](https://vuejs.org/v2/guide/components.html#sync-Modifier) on `music` and `mode` prop.
5359
@@ -61,6 +67,7 @@ The `music` props can either be an object containing info of the song to play, o
6167
| title | `'Untitled'` | Music title |
6268
| author | `'Unknown'` | Music author |
6369
| pic | *none* | Music cover picture |
70+
| theme | *none* | Song-specific theme color |
6471
| lrc | *none* | lrc or url to a .lrc file, see: [LRC](https://aplayer.js.org/#/home?id=lrc) |
6572

6673
> vue-aplayer uses [fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) to load your lrc when it's a url.
@@ -77,6 +84,23 @@ The `music` props can either be an object containing info of the song to play, o
7784
| ended | none | Triggered when APlayer ended playing |
7885
| error | none | Triggered when an error occurs |
7986

87+
## Advanced
88+
89+
### Self-adapting theme color
90+
Since `v1.3.0`, if you set a **Music Object**'s `theme` property to `'pic'`, Vue-APlayer will pick color from the songs cover image as theme color.
91+
Also, you can set player's `theme` prop to `'pic'`, it will apply to every song.
92+
93+
All you need to do is adding [color-thief](https://github.com/lokesh/color-thief) to your page.
94+
> Note that color-thief is **NOT module compatible**
95+
96+
```
97+
<!-- or other CDNs you prefer -->
98+
<script src="https://cdn.jsdelivr.net/npm/colorthief@2.0.2/src/color-thief.js"></script>
99+
```
100+
101+
### HLS support
102+
Since `v1.3.0`, Vue-APlayer supports `*.m3u8` media as an optional functionality. Simply install [hls.js](https://github.com/video-dev/hls.js) into your project, and Vue-APlayer handles the rest.
103+
80104
### Slots
81105

82106
- `slot="display"`

package.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vue-aplayer",
3-
"version": "1.2.2",
3+
"version": "1.3.0",
44
"description": "Easy-to-config music player for Vue 2.x",
55
"main": "dist/vue-aplayer.min.js",
66
"files": [
@@ -14,7 +14,6 @@
1414
"build:demo": "export NODE_ENV=production && webpack --progress --hide-modules --config webpack.demo.config.js",
1515
"prepublishOnly": "npm run build",
1616
"predeploy": "npm run build:demo && echo 'vue-aplayer.js.org' > demo/CNAME",
17-
"deploy": "gh-pages -d demo",
1817
"lint": "eslint --ext .js,.vue src"
1918
},
2019
"repository": {
@@ -40,7 +39,7 @@
4039
"homepage": "https://github.com/SevenOutman/vue-aplayer#readme",
4140
"dependencies": {},
4241
"peerDependencies": {
43-
"vue": "^2.5.13"
42+
"vue": "^2.5.16"
4443
},
4544
"devDependencies": {
4645
"autoprefixer": "^8.1.0",
@@ -55,14 +54,13 @@
5554
"eslint-loader": "^2.0.0",
5655
"eslint-plugin-vue": "^4.3.0",
5756
"file-loader": "^1.1.11",
58-
"gh-pages": "^1.1.0",
5957
"html-webpack-plugin": "^3.0.6",
6058
"node-sass": "^4.5.0",
6159
"postcss-loader": "^2.1.1",
6260
"sass-loader": "^6.0.7",
6361
"style-loader": "^0.20.2",
6462
"url-loader": "^1.0.1",
65-
"vue": "^2.5.13",
63+
"vue": "^2.5.16",
6664
"vue-html-loader": "^1.2.4",
6765
"vue-loader": "^14.2.1",
6866
"vue-template-compiler": "^2.5.13",
@@ -73,5 +71,8 @@
7371
"> 1%",
7472
"last 2 versions",
7573
"not ie <= 8"
76-
]
74+
],
75+
"optionalDependencies": {
76+
"hls.js": "^0.8.9"
77+
}
7778
}

src/components/aplayer-controller.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@
105105
top: 0;
106106
bottom: 0;
107107
height: 2px;
108+
transition: background-color .3s;
108109
109110
.aplayer-thumb {
110111
position: absolute;
@@ -115,10 +116,11 @@
115116
width: 10px;
116117
height: 10px;
117118
transform: scale(.8);
118-
transition: transform 300ms;
119+
transition: transform 300ms, background-color .3s, border-color .3s;
119120
border-radius: 50%;
120121
background: #fff;
121122
cursor: pointer !important;
123+
122124
&:hover {
123125
transform: scale(1);
124126
}
@@ -209,7 +211,7 @@
209211
bottom: 0;
210212
right: 0;
211213
width: 5px;
212-
transition: all 0.1s ease;
214+
transition: all 0.1s ease, background-color .3s;
213215
}
214216
}
215217
}

src/components/aplayer-list.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@
119119
left: 0;
120120
top: 5px;
121121
cursor: pointer;
122+
transition: background-color .3s;
123+
122124
}
123125
.aplayer-list-index {
124126
color: #666;

src/components/aplayer-thumbnail.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
</template>
1616
<script>
1717
import IconButton from './aplayer-iconbutton.vue'
18-
import {getElementViewLeft, getElementViewTop} from '../utils'
1918
2019
export default {
2120
components: {

0 commit comments

Comments
 (0)