Skip to content

Commit 4374465

Browse files
committed
update licence & readme
1 parent 016418d commit 4374465

File tree

2 files changed

+120
-1
lines changed

2 files changed

+120
-1
lines changed

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2017 Hiitea, Sabrina Luo
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 99 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,99 @@
1-
# React-APlayer
1+
# React-APlayer [![license](https://img.shields.io/github/license/mashape/apistatus.svg)]()
2+
A React wrapper component of [APlayer](https://github.com/DIYgod/APlayer)
3+
4+
## Introduction
5+
[Demo](http://sabrinaluo.com/react-aplayer/)
6+
7+
Screen shot
8+
[![](https://camo.githubusercontent.com/a69d395460135e5542a3fd3f9a09d3817d17c228/68747470733a2f2f692e696d6775722e636f6d2f4a44724a5843722e706e67)]()
9+
10+
## Usage
11+
```
12+
import React from 'react';
13+
import ReactAplayer from 'react-aplayer';
14+
15+
export default class App extends React.Component {
16+
constructor(props) {
17+
super(props);
18+
this.state = {};
19+
}
20+
21+
playHandler() {
22+
console.log('on play');
23+
}
24+
25+
pauseHandler() {
26+
console.log('on pause');
27+
}
28+
29+
render() {
30+
const props = {
31+
"autoplay": true,
32+
"mutex": true,
33+
"preload": "metadata",
34+
"music": {
35+
"author": "Hans Zimmer/Richard Harvey",
36+
"url": "http://devtest.qiniudn.com/Preparation.mp3",
37+
"pic": "http://devtest.qiniudn.com/Preparation.jpg"
38+
}
39+
};
40+
41+
return (
42+
<ReactAplayer {...props} onPlay={this.playHandler} onPause={this.pauseHandler}/>
43+
);
44+
}
45+
}
46+
```
47+
48+
### Props
49+
Props are almost the same with original APlayer, please check the [docs](https://aplayer.js.org/docs/#/) for more details.
50+
51+
| Name | Type | Required | Default | Description |
52+
|---|---|---|---|---|
53+
|autoplay| Boolean | N |`false` | |
54+
|listmaxheight| String | N | N/A |e.g. `'80px'` |
55+
|mode| String | |`'circulation'`|One of `'circulation'`, `'order'`, `'random'`, `'single'`|
56+
|mute| Boolean | |`false`| |
57+
|narrow| Boolean | |`false`| |
58+
|preload| String | |`'auto'`|One of `'auto'`, `'metadata'`, `'none'`|
59+
|showlrc| Number | |`0`| |
60+
|theme| String | |`'#b7daff'`| |
61+
|music| Array \| Object | Y | N/A | |
62+
|music.url| String | Y | | |
63+
|music.title| String | | N/A | |
64+
|music.author| String | | N/A | |
65+
|music.pic| String | | N/A | |
66+
|music.lrc| String | | N/A | |
67+
68+
### Event Handlers
69+
Event handlers are triggered when corresponding event happens, it takes a callback function as param.
70+
71+
|Name|Type | Description |
72+
|---|---|---|
73+
|onPlay| Func | |
74+
|onCanplay| Func | |
75+
|onPlay| Func | |
76+
|onPause| Func | |
77+
|onPlaying| Func | |
78+
|onEnded| Func | |
79+
|onError| Func | |
80+
81+
### APlayer Instance & Bind Methods
82+
APlayer Instance can be accessed through `.state.control`.
83+
84+
```
85+
<ReactAplayer {...props} ref={(ap) => {
86+
const aplayer = ap.state.control;
87+
}/>
88+
```
89+
90+
To expose APlayer methods on React level, binding is needed.
91+
```
92+
<ReactAplayer {...props} ref={(ap) => {
93+
const player = ap.state.control;
94+
this.play = player.play.bind(player);
95+
}}/>
96+
```
97+
98+
## LICENSE
99+
[MIT License](https://github.com/sabrinaluo/react-aplayer/blob/master/LICENSE)

0 commit comments

Comments
 (0)