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 mostly the same as [APlayer's options](https://aplayer.js.org/#/home?id=options).
42
+
43
+
### Props
40
44
41
45
| Name | Type | Default | Description |
42
46
| ---- | ---- | ------- | ----------- |
43
47
| music| Object |*required*| Music info for current playing music, see [Music info](https://github.com/SevenOutman/vue-aplayer#music-info)|
44
48
| 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. |
45
49
| mini | Boolean |`false`| Mini mode |
46
50
| float | Boolean |`false`| Float mode, in which you can drag the player around and leave it anywhere on your page |
47
-
| autoplay | Boolean |`false`| Whether to autoplay. If more than one mutex player are set autoplay, only the first one will play. |
48
51
| showLrc | Boolean |`false`| Whether to show lyrics or not |
49
52
| mutex | Boolean |`true`| Pause other players when this player is playing |
50
-
| theme | String |`'#b7daff'`| Theme color, will be overridden by current `music`'s theme if set |
53
+
| theme | String |`'#41b883'`| Theme color, will be overridden by current `music`'s theme if set |
51
54
| mode | String |`'circulation'`| Play mode, can be 'random' 'single 'circulation'(loop) or 'order'(no loop) |
52
-
| preload | String |`'auto'`| The way to load music, can be 'none' 'metadata' or 'auto' |
53
55
| listMaxHeight | String |*none*| Max height of play list |
54
56
| narrow ||| DEPRECATED, use `mini` instead |
55
57
| listmaxheight ||| DEPRECATED, use `listMaxHeight` instead |
56
58
| showlrc ||| DEPRECATED, use `showLrc` instead |
57
59
58
-
> 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.
60
+
> 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` props.
61
+
62
+
63
+
64
+
### Audio attributes as props
65
+
66
+
Since `v1.4.0`, we added some props that names after `<audio>` attributes and also work as they do
67
+
68
+
| Name | Type | Default | Observable | Description |
| autoplay | Boolean |`false`| false | Starts playing as soon as loaded. If more than one mutex player are set autoplay, only the first one will play.|
71
+
| controls | Boolean |`false`| true | Shows native audio controls below the player, or between player and playlist. This only works in develop environment, and doesn't work in Mini mode. |
72
+
| muted | Boolean |`false`| true | Player is muted. |
73
+
| preload | String |*none*| true | The way to load music, can be 'none' 'metadata' or 'auto' |
74
+
| volume | Number |`0.8`| true | Playback volume. |
75
+
76
+
> `muted` and `volume` props also accept `.sync` modifier, allowing you some custom external control capability.
77
+
78
+
59
79
60
80
### Music info
61
81
62
-
The `music` props can either be an object containing info of the song to play, or an array of such objects.
82
+
The `music` props contains info of the song to play.
63
83
64
84
| Property | Default | Description |
65
85
| -------- | ------- | ----------- |
66
-
|url|*required*| Music source url |
86
+
|src|*required*| Music source url |
67
87
| title |`'Untitled'`| Music title |
68
88
| author |`'Unknown'`| Music author |
69
89
| pic |*none*| Music cover picture |
70
-
| theme |*none*| Song-specific theme color |
71
90
| lrc |*none*| lrc or url to a .lrc file, see: [LRC](https://aplayer.js.org/#/home?id=lrc)|
91
+
| theme |*none*| Song-specific theme color |
92
+
| url || DEPRECATED, use `src` instead |
93
+
72
94
73
-
> 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.
74
-
> If your browser doesn't support fetch by default, please use polyfills like [isomorphic-fetch](https://github.com/matthew-andrews/isomorphic-fetch).
75
95
76
96
### Events
77
97
78
-
| Name | Params | Description |
79
-
| ---- | ------ | ----------- |
80
-
| play | none | Triggered when APlayer start play |
81
-
| pause | none | Triggered when APlayer paused |
82
-
| canplay | none | Triggered when enough data is available that APlayer can play |
83
-
| playing | none | Triggered periodically when APlayer is playing |
84
-
| ended | none | Triggered when APlayer ended playing |
85
-
| error | none | Triggered when an error occurs |
98
+
Since `v1.4.0`, Vue-APlayer emits every Media Element triggered from its inner `<audio>` element. You can [refer to MDN for the full list](https://developer.mozilla.org/en-US/docs/Web/Guide/Events/Media_events).
99
+
100
+
Custom events that were supported before `v1.4.0`, which are `play``pause``canplay``playing``ended``error`, are all deprecated now.
101
+
102
+
86
103
87
104
## Advanced
88
105
89
106
### Self-adapting theme color
107
+
90
108
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
109
Also, you can set player's `theme` prop to `'pic'`, it will apply to every song.
92
110
@@ -98,9 +116,14 @@ All you need to do is adding [color-thief](https://github.com/lokesh/color-thief
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
124
125
+
126
+
104
127
### Slots
105
128
106
129
-`slot="display"`
@@ -109,6 +132,8 @@ This slot represents the content displayed on the music info panel, which by def
109
132
110
133
The component in this slot will receive two props: `currentMusic` and `playStat`.
0 commit comments