Skip to content
This repository was archived by the owner on Dec 2, 2020. It is now read-only.

Commit d684f49

Browse files
committed
upgrade version 0.2.0
fix #1
1 parent ab59232 commit d684f49

File tree

7 files changed

+4765
-790
lines changed

7 files changed

+4765
-790
lines changed

README.md

Lines changed: 5 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[![NPM](https://img.shields.io/npm/dt/react-dplayer.svg?style=flat)](https://www.npmjs.com/package/react-dplayer)
44
[![LICENSE](https://img.shields.io/badge/license-MIT-green.svg?style=flat)](https://github.com/hnsylitao/react-dplayer/blob/master/LICENSE)
55

6-
# react-dplayer[Live Demo](http://dplayer.89io.com/)
6+
# react-dplayer[Live Demo](http://dplayer.89io.com/) (V1.22.2)
77

88
**React component for Dplayer** based on [DPlayer](https://github.com/DIYgod/DPlayer).
99

@@ -46,22 +46,9 @@ class Example extends Component {
4646
ReactDOM.render(React.createElement(
4747
'div',
4848
{ style: { width: 800, margin: '0px auto' } },
49-
React.createElement(ReactDPlayer, { autoplay: false,
50-
loop: false,
51-
screenshot: true,
52-
hotkey: true,
53-
logo: 'https://avatars3.githubusercontent.com/u/17537749?v=4&s=460',
54-
danmaku: {
55-
id: '9E2E3368B56CDBB4',
56-
api: 'https://api.prprpr.me/dplayer/',
57-
token: 'tokendemo',
58-
maximum: 1000,
59-
addition: ['https://api.prprpr.me/dplayer/bilibili?aid=4157142'],
60-
user: 'DIYgod'
61-
},
49+
React.createElement(ReactDPlayer, {
6250
video: {
63-
url: 'http://static.smartisanos.cn/common/video/t1-ui.mp4',
64-
pic: 'http://static.smartisanos.cn/pr/img/video/video_03_cc87ce5bdb.jpg'
51+
url: 'http://static.smartisanos.cn/common/video/t1-ui.mp4'
6552
} })
6653
), document.getElementById('example'));
6754
</script>
@@ -76,29 +63,13 @@ The package also includes an in-built example under the `/example` folder. Run t
7663

7764
| Name | Type | Default | Description |
7865
| ---- | ---- | ------- | ----------- |
79-
| autoplay | Boolean | false | autoplay video, not supported by mobile browsers |
80-
| theme | String | #FADFA3 | theme color |
81-
| loop | Boolean | true | loop play video |
82-
| lang | String | zh | `zh` for Chinese, `en` for English |
83-
| screenshot | Boolean | false | enable screenshot function |
84-
| hotkey | Boolean | true | binding hot key, including left right and Space |
85-
| preload | String | 'auto' | the way to load video, can be 'none' 'metadata' or 'auto' |
86-
| logo | String | DPlayer default | player logo, showing in top left corner |
87-
| volume | Number | DPlayer default | player volume |
88-
| contextmenu | Array | DPlayer default | custom contextmenu |
89-
| video| Object | DPlayer default | video.url -> video link video.pic -> video poster video.type -> video type video.quality -> video quality video.defaultQuality -> video defaultQuality|
90-
| danmaku| Object | DPlayer default | video danmaku |
66+
| allProps | Object | default | [read doc](http://dplayer.js.org/#/zh-Hans/?id=%E5%8F%82%E6%95%B0) |
9167

9268
## Events
9369

9470
| Name | Params | Description |
9571
| ---- | ------ | ----------- |
96-
| onPlay | DPlayer default | Triggered when DPlayer start play |
97-
| onPause | DPlayer default | Triggered when DPlayer paused |
98-
| onCanplay | DPlayer default | Triggered when enough data is available that DPlayer can play |
99-
| onPlaying | DPlayer default | Triggered periodically when DPlayer is playing |
100-
| onEnded | DPlayer default | Triggered when DPlayer ended playing |
101-
| onError | DPlayer default | Triggered when an error occurs |
72+
| allEvent | default | [read doc](http://dplayer.js.org/#/zh-Hans/?id=%E4%BA%8B%E4%BB%B6%E7%BB%91%E5%AE%9A) |
10273

10374
## Development
10475

example/example.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ const path = require('path')
66
, HtmlWebpackPlugin = require('html-webpack-plugin')
77

88
module.exports = {
9+
mode: 'development',
910
entry: {
1011
bundle: ["babel-polyfill", path.resolve(srcPath, 'example.js')]
1112
},

example/example.js

Lines changed: 25 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5,90 +5,88 @@ import DPlayer from "../src";
55

66
const Example = reactCreateClass({
77

8-
getInitialState(){
8+
getInitialState() {
99
return {
1010
canplay: false,
1111
play: false,
1212
currentTime: 0,
1313
};
1414
},
1515

16-
seek(){
16+
seek() {
1717
this.dp.seek(10)
1818
},
1919

20-
play(){
20+
play() {
2121
this.dp.play()
2222
},
2323

24-
pause(){
24+
pause() {
2525
this.dp.pause()
2626
},
2727

28-
onLoad(dp){
28+
onLoad(dp) {
2929
this.dp = dp;
3030
console.log(dp, dp.video);
3131
},
3232

33-
onCanplay(){
33+
onCanplay() {
3434
this.setState({
3535
canplay: true,
3636
})
3737
},
3838

39-
onPlay(){
39+
onPlay() {
4040
this.setState({
4141
play: true,
4242
})
4343
},
4444

45-
onPause(){
45+
onPause() {
4646
this.setState({
4747
play: false,
4848
})
4949
},
5050

51-
onEnded(){
51+
onEnded() {
5252
console.log('end')
5353
},
5454

55-
onError(){
55+
onError() {
5656
console.log('error')
5757
},
5858

59-
onPlaying(){
59+
onPlaying() {
6060
this.setState({
6161
currentTime: this.dp.video.currentTime,
6262
})
6363
},
6464

6565
render() {
6666
return (
67-
<div style={{width: 800,margin:'0px auto'}}>
68-
<DPlayer autoplay={false}
69-
loop={false}
70-
screenshot={true}
71-
hotkey={true}
67+
<div style={{width: 800, margin: '0px auto'}}>
68+
<DPlayer loop={false}
7269
logo={'https://avatars3.githubusercontent.com/u/17537749?v=4&s=460'}
70+
video={{
71+
url: 'https://moeplayer.b0.upaiyun.com/dplayer/hikarunara.mp4',
72+
pic: 'https://moeplayer.b0.upaiyun.com/dplayer/hikarunara.png',
73+
thumbnails: 'https://moeplayer.b0.upaiyun.com/dplayer/hikarunara_thumbnails.jpg'
74+
}}
75+
subtitl={{
76+
url: 'https://moeplayer.b0.upaiyun.com/dplayer/hikarunara.vtt'
77+
}}
7378
danmaku={{
7479
id: '9E2E3368B56CDBB4',
75-
api: 'https://api.prprpr.me/dplayer/',
76-
token: 'tokendemo',
77-
maximum: 1000,
78-
addition: ['https://api.prprpr.me/dplayer/bilibili?aid=4157142'],
79-
user: 'DIYgod'
80+
api: 'https://api.prprpr.me/dplayer/'
8081
}}
82+
screenshot={true}
8183
onLoad={this.onLoad}
8284
onPlay={this.onPlay}
8385
onCanplay={this.onCanplay}
8486
onPause={this.onPause}
8587
onEnded={this.onEnded}
8688
onError={this.onError}
87-
onPlaying={this.onPlaying}
88-
video={{
89-
url: 'http://static.smartisanos.cn/common/video/t1-ui.mp4',
90-
pic: 'http://static.smartisanos.cn/pr/img/video/video_03_cc87ce5bdb.jpg'
91-
}}/>
89+
onPlaying={this.onPlaying}/>
9290
<button onClick={this.play}>play</button>
9391
<button onClick={this.pause}>pause</button>
9492
<button onClick={this.seek}>seek 10</button>
@@ -102,6 +100,6 @@ const Example = reactCreateClass({
102100
});
103101

104102
ReactDOM.render(
105-
<Example />,
103+
<Example/>,
106104
document.getElementById('example')
107105
);

0 commit comments

Comments
 (0)