fix readme

This commit is contained in:
zhw2590582 committed 2019-04-27 20:26:30 +08:00
1 parent 8e825effdb
commit 00d8b77e89
2 files changed
+9 -51

No files matched your search

+1
View File
@@ -36,6 +36,7 @@
| [artplayer-plugin-backlight](https://github.com/zhw2590582/ArtPlayer/tree/master/packages/artplayer-plugin-backlight) | Backlight plugin for ArtPlayer | [demo](https://artplayer.org/?libs=.%2Funcompiled%2Fartplayer-plugin-backlight.js&example=backlight) |
| [artplayer-plugin-playlist](https://github.com/zhw2590582/ArtPlayer/tree/master/packages/artplayer-plugin-playlist) | Playlist plugin for ArtPlayer | [demo](https://artplayer.org/?libs=.%2Funcompiled%2Fartplayer-plugin-playlist.js%0A.%2Funcompiled%2Fartplayer-plugin-playlist.css&example=playlist) |
| [artplayer-tool-thumbnail](https://github.com/zhw2590582/ArtPlayer/tree/master/packages/artplayer-tool-thumbnail) | Thumbnail tool for ArtPlayer | [demo](https://artplayer.org/?libs=.%2Funcompiled%2Fartplayer-tool-thumbnail.js&example=thumbnail) |
| [artplayer-tool-github](https://github.com/zhw2590582/ArtPlayer/tree/master/packages/artplayer-tool-github) | Github api tool for ArtPlayer | [demo](https://artplayer.org/?libs=.%2Funcompiled%2Fartplayer-tool-github.js%0A.%2Funcompiled%2Fartplayer-plugin-danmu.js&example=github) |
| [artplayer-react](https://github.com/zhw2590582/ArtPlayer/tree/master/packages/artplayer-react) | React Component for Artplayer | [demo](https://codesandbox.io/s/n74859y9rl) |
| [artplayer-vue](https://github.com/zhw2590582/ArtPlayer/tree/master/packages/artplayer-vue) | Vue Component for Artplayer | [demo](https://codesandbox.io/s/6z76lm109n) |
+8 -51
View File
@@ -1,79 +1,36 @@
# artplayer-plugin-danmu
# artplayer-plugin-github
Danmu plugin for ArtPlayer
## Demo
[Checkout the demo](https://artplayer.org/?libs=.%2Funcompiled%2Fartplayer-plugin-danmu.js&example=danmu) from Github Pages
[Checkout the demo](https://artplayer.org/?libs=./uncompiled/artplayer-tool-github.js%0A./uncompiled/artplayer-plugin-danmu.js&example=github) from Github Pages
## Install
Install with `npm`
```
$ npm install artplayer-plugin-danmu
$ npm install artplayer-plugin-github
```
Or install with `yarn`
```
$ yarn add artplayer-plugin-danmu
$ yarn add artplayer-plugin-github
```
```js
import artplayerPluginBacklight from 'artplayer-plugin-danmu';
import ArtplayerToolGithub from 'artplayer-plugin-github';
```
Or umd builds are also available
```html
<script src="artplayer-plugin-danmu.js"></script>
<script src="artplayer-plugin-github.js"></script>
```
Will expose the global variable to `window.artplayerPluginDanmu`.
## Usage
```js
var art = new Artplayer({
container: '.artplayer-app',
url: 'path/to/video.mp4',
plugins: [artplayerPluginDanmu({
danmus: [], // Can be an array or return the promised function or danmuku xml url
speed: 5, // Animation time
opacity: 1, // Opacity
color: '#fff', // Font color
size: 25, // Font size
maxlength: 50, // The maximum number of words in the danmu
margin: [10, 20], // Margin top and margin bottom
})],
});
// Send danmu
art.plugins.artplayerPluginDanmu.emit({
text: '666', // Danmu text
time: 5, // Video time
color: '#fff', // Danmu color
size: 25, // Danmu size
border: '#fff' // Danmu border color
});
// Start danmu
art.plugins.artplayerPluginDanmu.start();
// Stop danmu
art.plugins.artplayerPluginDanmu.stop();
// Hide danmu
art.plugins.artplayerPluginDanmu.hide();
// Show danmu
art.plugins.artplayerPluginDanmu.show();
// Config danmu
art.plugins.artplayerPluginDanmu.config({
// option
});
```
Will expose the global variable to `window.ArtplayerToolGithub`.
## License