diff --git a/CNAME b/CNAME new file mode 100644 index 0000000..e8d7166 --- /dev/null +++ b/CNAME @@ -0,0 +1 @@ +dplayer.js.org \ No newline at end of file diff --git a/dist/DPlayer.min.css b/DPlayer.min.css similarity index 100% rename from dist/DPlayer.min.css rename to DPlayer.min.css diff --git a/dist/DPlayer.min.js b/DPlayer.min.js similarity index 100% rename from dist/DPlayer.min.js rename to DPlayer.min.js diff --git a/dist/DPlayer.min.js.map b/DPlayer.min.js.map similarity index 100% rename from dist/DPlayer.min.js.map rename to DPlayer.min.js.map diff --git a/README.md b/README.md deleted file mode 100644 index 03d1143..0000000 --- a/README.md +++ /dev/null @@ -1,142 +0,0 @@ -# DPlayer - -[![npm](https://img.shields.io/npm/v/dplayer.svg?style=flat-square)](https://www.npmjs.com/package/dplayer) -[![npm](https://img.shields.io/npm/l/dplayer.svg?style=flat-square)](https://www.npmjs.com/package/dplayer) -[![devDependency Status](https://img.shields.io/david/dev/DIYgod/dplayer.svg?style=flat-square)](https://david-dm.org/DIYgod/DPlayer#info=devDependencies) -[![npm](https://img.shields.io/npm/dt/dplayer.svg?style=flat-square)](https://www.npmjs.com/package/dplayer) -[![Travis](https://img.shields.io/travis/DIYgod/DPlayer.svg?style=flat-square)](https://travis-ci.org/DIYgod/DPlayer) -[![%e2%9d%a4](https://img.shields.io/badge/made%20with-%e2%9d%a4-ff69b4.svg?style=flat-square)](https://www.anotherhome.net/) - -> Wow, such a lovely HTML5 danmaku video player - -## Introduction - -[Demo](http://diygod.github.io/DPlayer/demo/) - -Screenshot -![image](http://i.imgur.com/207ch36.jpg) - -## Install - -``` -$ npm install dplayer --save -``` - -## Usage - -### HTML - -```HTML - - -
- - -``` - -### JS - -```JS -var dp = new DPlayer(option); -dp.init(); -``` - -**Options** - -```JS -var option = { - element: document.getElementById('player1'), // Optional, player element - autoplay: false, // Optional, autoplay video, not supported by mobile browsers - theme: '#FADFA3', // Optional, theme color, default: #b7daff - loop: true, // Optional, loop play music, default: true - video: { // Required, video info - url: '若能绽放光芒.mp4', // Required, video url - pic: '若能绽放光芒.png' // Optional, music picture - }, - danmaku: { // Optional, showing danmaku - id: '9E2E3368B56CDBB4', // Required, danmaku id, MUST BE UNIQUE, CAN NOT USE THESE IN YOUR NEW PLAYER: `https://dplayer.daoapp.io/list` - api: 'https://dplayer.daoapp.io/', // Required, danmaku api - token: 'tokendemo', // Optional, danmaku token for api - maximum: 1000 // Optional, maximum quantity of danmaku - } -} -``` - -**API** - -+ `dp.init()` -+ `dp.play()` -+ `dp.pause()` - -**Event binding** - -`dp.on(event, handler)` - -`event`: -+ `play`: Triggered when DPlayer start play -+ `pause`: Triggered when DPlayer paused -+ `canplay`: Triggered when enough data is available that DPlayer can be played -+ `playing`: Triggered periodically when DPlayer is playing -+ `ended`: Triggered when DPlayer ended -+ `error`: Triggered when an error occurs - -**Work with module bundler** - -```js -var DPlayer = require('DPlayer'); -var dp = new DPlayer(option); -dp.init(); -``` - -### Danmaku back-end - -**Ready-made API:** - -`https://dplayer.daoapp.io/` - -**Build yourself:** - -Required environment - -- Node.js -- Mongodb - -## Run in development - -``` -$ npm install -$ npm run dev -``` - -## Make a release - -``` -$ npm install -$ npm run build -``` - -## Related Projects - -- [DPlayer-for-typecho](https://github.com/volio/DPlayer-for-typecho) -- [Hexo-tag-dplayer](https://github.com/NextMoe/hexo-tag-dplayer) -- [DPlayer_for_Z-BlogPHP](https://github.com/fghrsh/DPlayer_for_Z-BlogPHP) - -## Todo - -- [ ] 截图 - -- [ ] 记录播放位置 记录透明度 - -- [ ] 国际化 - -- [ ] 微博登录 - -- [ ] 锁定IP规则 - -- [ ] icon 动画 - -- [ ] 字体 - -## LICENSE - -MIT © [DIYgod](http://github.com/DIYgod) diff --git a/demo/danmaku.json b/demo/danmaku.json deleted file mode 100644 index 968bda5..0000000 --- a/demo/danmaku.json +++ /dev/null @@ -1,109 +0,0 @@ -{ - "code": 1, - "danmaku": [ - { - "player": "9E2E3368B56CDBB4", - "author": "DIYgod", - "time": 2.8, - "text": "此生无悔入", - "color": "#f00", - "type": "right" - }, - { - "player": "9E2E3368B56CDBB4", - "author": "DIYgod", - "time": 1.6, - "text": "此生无悔入四月来世愿做友人A", - "color": "#ff0", - "type": "right" - }, - { - "player": "9E2E3368B56CDBB4", - "author": "DIYgod", - "time": 0.4, - "text": "此生无悔入四月来世", - "color": "#f00", - "type": "right" - }, - { - "player": "9E2E3368B56CDBB4", - "author": "DIYgod", - "time": 0.8, - "text": "此生无悔入四月来世愿做友人A此生无悔入四月来世愿做", - "color": "#0f0", - "type": "right" - }, - { - "player": "9E2E3368B56CDBB4", - "author": "DIYgod", - "time": 1.2, - "text": "此生无悔入四月来世愿做友人", - "color": "#00f", - "type": "right" - }, - { - "player": "9E2E3368B56CDBB4", - "author": "DIYgod", - "time": 2.0, - "text": "此生无悔入四月来世愿做友人A", - "color": "#f0f", - "type": "right" - }, - { - "player": "9E2E3368B56CDBB4", - "author": "DIYgod", - "time": 2.4, - "text": "此生无悔入四月来世愿做友人A", - "color": "#0ff", - "type": "right" - }, - { - "player": "9E2E3368B56CDBB4", - "author": "DIYgod", - "time": 2.4, - "text": "此生无悔入四月来世", - "color": "#f00", - "type": "top" - }, - { - "player": "9E2E3368B56CDBB4", - "author": "DIYgod", - "time": 2.8, - "text": "此生无悔入四月", - "color": "#0f0", - "type": "top" - }, - { - "player": "9E2E3368B56CDBB4", - "author": "DIYgod", - "time": 4.0, - "text": "此生无悔入四月来世愿做友人A", - "color": "#ff0", - "type": "top" - }, - { - "player": "9E2E3368B56CDBB4", - "author": "DIYgod", - "time": 4.0, - "text": "此生无悔入四做友人A", - "color": "#f0f", - "type": "top" - }, - { - "player": "9E2E3368B56CDBB4", - "author": "DIYgod", - "time": 6, - "text": "此生无悔入", - "color": "#f00", - "type": "bottom" - }, - { - "player": "9E2E3368B56CDBB4", - "author": "DIYgod", - "time": 6.4, - "text": "此生无悔入四月来世愿做友人A", - "color": "#f0f", - "type": "bottom" - } - ] -} \ No newline at end of file diff --git a/gulpfile.js b/gulpfile.js deleted file mode 100644 index c7383ba..0000000 --- a/gulpfile.js +++ /dev/null @@ -1,72 +0,0 @@ -var gulp = require('gulp'); -var sass = require('gulp-sass'); -var prefix = require('gulp-autoprefixer'); -var uglify = require('gulp-uglify'); -var concat = require('gulp-concat'); -var cssNano = require('gulp-cssnano'); -var rename = require('gulp-rename'); -var babel = require("gulp-babel"); -var sourcemaps = require("gulp-sourcemaps"); -var browserSync = require('browser-sync').create(); - -// Launch the server -gulp.task('browser-sync', function() { - browserSync.init({ - server: { - baseDir: './' - }, - startPath: '/demo' - }); -}); - -// Move files -gulp.task('copy', function () { - gulp.src('src/font/*') - .pipe(gulp.dest('dist/font')); - gulp.src(['src/*.jpg', 'src/*.png']) - .pipe(gulp.dest('dist')); -}); - -// Build js files -gulp.task('compressJS', function() { - gulp.src(['src/*.js']) - .pipe(sourcemaps.init()) - .pipe(babel({ - presets: ['es2015'] - })) - .pipe(uglify()) - .pipe(rename({ - suffix: ".min" - })) - .pipe(sourcemaps.write(".")) - .pipe(gulp.dest('dist')) - .pipe(browserSync.stream()); -}); - -// Build css files -gulp.task('compressCSS', function() { - gulp.src('src/*.scss') - .pipe(sass().on('error', sass.logError)) - .pipe(prefix(['last 15 versions', '> 1%', 'ie 8', 'ie 7'], { cascade: true })) - .pipe(cssNano()) - .pipe(rename({ - suffix: ".min" - })) - .pipe(gulp.dest('dist')) - .pipe(browserSync.stream()); -}); - -// Watch files for changes & recompile -gulp.task('watch', function () { - gulp.watch(['src/*.js'], ['compressJS']); - gulp.watch(['src/*.scss'], ['compressCSS']); - gulp.watch('demo/*.html').on('change', browserSync.reload); - gulp.watch('demo2/*.html').on('change', browserSync.reload); - gulp.watch('demo/font/*', ['copy']); -}); - -// compile the project, including move font, compress js and scss, also be used to test -gulp.task('release', ['copy', 'compressJS', 'compressCSS']); - -// Default task, running just `gulp` will move font, compress js and scss, launch server, watch files. -gulp.task('default', ['release', 'browser-sync', 'watch']); \ No newline at end of file diff --git a/demo/index.html b/index.html similarity index 97% rename from demo/index.html rename to index.html index 2db23a2..e4eebf5 100644 --- a/demo/index.html +++ b/index.html @@ -4,7 +4,7 @@ DPlayer Demo - +