mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-08 19:06:15 -08:00
build all packages
This commit is contained in:
1 parent
7c72e3ecd8
commit
429330a7e2
10 files changed
+3215
No files matched your search
Vendored
+1
@@ -0,0 +1 @@
|
||||
.artplayerPluginDanmu{display:-webkit-box;display:-ms-flexbox;display:flex}
|
||||
@@ -0,0 +1,60 @@
|
||||
// 接口每小时限制 5000 次请求,勿滥用
|
||||
var github = new ArtplayerToolGithub({
|
||||
api: 'zhw2590582/github-issues-api-as-danmuku/issues/1',
|
||||
clientID: '749a95aad589f8849abe',
|
||||
clientSecret: '7bb6fa67ef6e525e5bd5fda46cd3925ecc4a3760',
|
||||
});
|
||||
|
||||
var url = 'https://zhw2590582.github.io/assets-cdn';
|
||||
var art = new Artplayer({
|
||||
container: '.artplayer-app',
|
||||
url: url + '/video/you-name.mp4',
|
||||
autoSize: true,
|
||||
controls: [
|
||||
{
|
||||
name: 'danmuku',
|
||||
position: 'right',
|
||||
html: '发送弹幕',
|
||||
click: () => {
|
||||
if (!github.isLogin) {
|
||||
github.login();
|
||||
} else {
|
||||
var text = prompt('请输入:', '弹幕内容');
|
||||
if (!text || !text.trim()) return;
|
||||
if (github.remaining <= 10) {
|
||||
art.notice.show('接口请求到达上限,请稍后再试!!!');
|
||||
return;
|
||||
}
|
||||
art.notice.show('弹幕发送中...');
|
||||
github
|
||||
.send({
|
||||
text: text,
|
||||
time: art.player.currentTime,
|
||||
color: '#' + Math.floor(Math.random() * 0xffffff).toString(16),
|
||||
})
|
||||
.then(data => {
|
||||
art.notice.show(`发送弹幕成功: ${github.remaining} / ${github.limit}`);
|
||||
art.plugins.artplayerPluginDanmu.emit({
|
||||
...data,
|
||||
time: art.player.currentTime,
|
||||
border: data.color,
|
||||
});
|
||||
}).catch(() => {
|
||||
art.notice.show(`发送弹幕失败: ${github.remaining} / ${github.limit}`);
|
||||
});
|
||||
}
|
||||
},
|
||||
},
|
||||
],
|
||||
plugins: [
|
||||
artplayerPluginDanmu({
|
||||
danmus: () => github.cache(),
|
||||
speed: 5,
|
||||
opacity: 1,
|
||||
color: '#fff',
|
||||
size: 25,
|
||||
maxlength: 50,
|
||||
margin: [10, 100],
|
||||
}),
|
||||
],
|
||||
});
|
||||
@@ -34,6 +34,7 @@
|
||||
<ul>
|
||||
<li class="title">Tools</li>
|
||||
<li><a href="./?libs=.%2Funcompiled%2Fartplayer-tool-thumbnail.js&example=thumbnail">artplayer-tool-thumbnail</a></li>
|
||||
<li><a href="./?libs=.%2Funcompiled%2Fartplayer-tool-github.js%0A.%2Funcompiled%2Fartplayer-plugin-danmu.js&example=github">artplayer-tool-github</a></li>
|
||||
</ul>
|
||||
<ul>
|
||||
<li class="title">Component</li>
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"artplayer-tool-github.js","sources":["../../packages/artplayer-tool-github/node_modules/localforage/dist/localforage.js","../../packages/artplayer-tool-github/node_modules/issues-danmuku/src/utils.js","../../packages/artplayer-tool-github/node_modules/issues-danmuku/src/index.js","../../packages/artplayer-tool-github/src/index.js"],"sourcesContent":["/*!\n localForage -- Offline Storage, Improved\n Version 1.7.3\n https://localforage.github.io/localForage\n (c) 2013-2017 Mozilla, Apache License 2.0\n*/\n(function(f){if(typeof exports===\"object\"&&typeof module!==\"undefined\"){module.exports=f()}else if(typeof define===\"function\"&&define.amd){define([],f)}else{var g;if(typeof window!==\"undefined\"){g=window}else if(typeof global!==\"undefined\"){g=global}else if(typeof self!==\"undefined\"){g=self}else{g=this}g.localforage = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\"function\"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\"Cannot find module '\"+o+\"'\");throw (f.code=\"MODULE_NOT_FOUND\", f)}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\"function\"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){\n(function (global){\n'use strict';\nvar Mutation = global.MutationObserver || global.WebKitMutationObserver;\n\nvar scheduleDrain;\n\n{\n if (Mutation) {\n var called = 0;\n var observer = new Mutation(nextTick);\n var element = global.document.createTextNode('');\n observer.observe(element, {\n characterData: true\n });\n scheduleDrain = function () {\n element.data = (called = ++called % 2);\n };\n } else if (!global.setImmediate && typeof global.MessageChannel !== 'undefined') {\n var channel = new global.MessageChannel();\n channel.port1.onmessage = nextTick;\n scheduleDrain = function () {\n channel.port2.postMessage(0);\n };\n } else if ('document' in global && 'onreadystatechange' in global.document.createElement('script')) {\n scheduleDrain = function () {\n\n // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted\n // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.\n var scriptEl = global.document.createElement('script');\n scriptEl.onreadystatechange = function () {\n nextTick();\n\n scriptEl.onreadystatechange = null;\n scriptEl.parentNode.removeChild(scriptEl);\n scriptEl = null;\n };\n global.document.documentElement.appendChild(scriptEl);\n };\n } else {\n scheduleDrain = function () {\n setTimeout(nextTick, 0);\n };\n }\n}\n\nvar draining;\nvar queue = [];\n//named nextTick for less confusing stack traces\nfunction nextTick() {\n draining = true;\n var i, oldQueue;\n var len = queue.length;\n while (len) {\n oldQueue = queue;\n queue = [];\n i = -1;\n while (++i < len) {\n oldQueue[i]();\n }\n len = queue.length;\n }\n draining = false;\n}\n\nmodule.exports = immediate;\nfunction immediate(task) {\n if (queue.push(task) === 1 && !draining) {\n scheduleDrain();\n }\n}\n\n}).call(this,typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\n},{}],2:[function(_dereq_,module,exports){\n'use strict';\nvar immediate = _dereq_(1);\n\n/* istanbul ignore next */\nfunction INTERNAL() {}\n\nvar handlers = {};\n\nvar REJECTED = ['REJECTED'];\nvar FULFILLED = ['FULFILLED'];\nvar PENDING = ['PENDING'];\n\nmodule.exports = Promise;\n\nfunction Promise(resolver) {\n if (typeof resolver !== 'function') {\n throw new TypeError('resolver must be a function');\n }\n this.state = PENDING;\n this.queue = [];\n this.outcome = void 0;\n if (resolver !== INTERNAL) {\n safelyResolveThenable(this, resolver);\n }\n}\n\nPromise.prototype[\"catch\"] = function (onRejected) {\n return this.then(null, onRejected);\n};\nPromise.prototype.then = function (onFulfilled, onRejected) {\n if (typeof onFulfilled !== 'function' && this.state === FULFILLED ||\n typeof onRejected !== 'function' && this.state === REJECTED) {\n return this;\n }\n var promise = new this.constructor(INTERNAL);\n if (this.state !== PENDING) {\n var resolver = this.state === FULFILLED ? onFulfilled : onRejected;\n unwrap(promise, resolver, this.outcome);\n } else {\n this.queue.push(new QueueItem(promise, onFulfilled, onRejected));\n }\n\n return promise;\n};\nfunction QueueItem(promise, onFulfilled, onRejected) {\n this.promise = promise;\n if (typeof onFulfilled === 'function') {\n this.onFulfilled = onFulfilled;\n this.callFulfilled = this.otherCallFulfilled;\n }\n if (typeof onRejected =Line truncated
|
||||
@@ -0,0 +1,9 @@
|
||||
node_modules
|
||||
.DS_Store
|
||||
yarn.lock
|
||||
package-lock.json
|
||||
test
|
||||
coverage
|
||||
.nyc_output
|
||||
.cache
|
||||
docs
|
||||
@@ -0,0 +1 @@
|
||||
package-lock=false
|
||||
@@ -0,0 +1,80 @@
|
||||
# artplayer-plugin-danmu
|
||||
Danmu plugin for ArtPlayer
|
||||
|
||||
## Demo
|
||||
|
||||
[Checkout the demo](https://artplayer.org/?libs=.%2Funcompiled%2Fartplayer-plugin-danmu.js&example=danmu) from Github Pages
|
||||
|
||||
## Install
|
||||
|
||||
Install with `npm`
|
||||
|
||||
```
|
||||
$ npm install artplayer-plugin-danmu
|
||||
```
|
||||
|
||||
Or install with `yarn`
|
||||
|
||||
```
|
||||
$ yarn add artplayer-plugin-danmu
|
||||
```
|
||||
|
||||
```js
|
||||
import artplayerPluginBacklight from 'artplayer-plugin-danmu';
|
||||
```
|
||||
|
||||
Or umd builds are also available
|
||||
|
||||
```html
|
||||
<script src="artplayer-plugin-danmu.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
|
||||
});
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Harvey Zack](https://sleepy.im/)
|
||||
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"name": "artplayer-tool-github",
|
||||
"version": "3.1.7",
|
||||
"description": "Github tool for ArtPlayer",
|
||||
"main": "dist/artplayer-tool-github.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/zhw2590582/ArtPlayer.git"
|
||||
},
|
||||
"keywords": [
|
||||
"video",
|
||||
"player"
|
||||
],
|
||||
"author": "Harvey Zack <laozhaochaguan@gmail.com>",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/zhw2590582/ArtPlayer/issues"
|
||||
},
|
||||
"homepage": "https://github.com/zhw2590582/ArtPlayer#readme",
|
||||
"dependencies": {
|
||||
"issues-danmuku": "^1.0.2"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
import ArtplayerToolGithub from 'issues-danmuku/src';
|
||||
|
||||
window.ArtplayerToolGithub = ArtplayerToolGithub;
|
||||
export default ArtplayerToolGithub;
|
||||
Reference in new issue
Block a user