From 5091db3d1d45693ff499d7a3ba561bdd328e3c4b Mon Sep 17 00:00:00 2001 From: zhw2590582 Date: Tue, 30 Nov 2021 07:20:16 +0800 Subject: [PATCH] remove some files --- docs/assets/example/backlight.js | 21 --- docs/assets/example/github.js | 68 --------- docs/assets/js/ssr.js | 132 ------------------ docs/index.html | 6 - docs/ssr.html | 60 -------- .../artplayer-plugin-backlight/.npmignore | 9 -- packages/artplayer-plugin-backlight/.npmrc | 1 - packages/artplayer-plugin-backlight/README.md | 47 ------- .../dist/artplayer-plugin-backlight.js | 8 -- .../artplayer-plugin-backlight/package.json | 25 ---- .../artplayer-plugin-backlight/src/index.js | 115 --------------- packages/artplayer-tool-github/.npmignore | 9 -- packages/artplayer-tool-github/.npmrc | 1 - packages/artplayer-tool-github/README.md | 37 ----- .../dist/artplayer-tool-github.js | 8 -- packages/artplayer-tool-github/package.json | 28 ---- packages/artplayer-tool-github/src/index.js | 3 - 17 files changed, 578 deletions(-) delete mode 100644 docs/assets/example/backlight.js delete mode 100644 docs/assets/example/github.js delete mode 100644 docs/assets/js/ssr.js delete mode 100644 docs/ssr.html delete mode 100644 packages/artplayer-plugin-backlight/.npmignore delete mode 100644 packages/artplayer-plugin-backlight/.npmrc delete mode 100644 packages/artplayer-plugin-backlight/README.md delete mode 100644 packages/artplayer-plugin-backlight/dist/artplayer-plugin-backlight.js delete mode 100644 packages/artplayer-plugin-backlight/package.json delete mode 100644 packages/artplayer-plugin-backlight/src/index.js delete mode 100644 packages/artplayer-tool-github/.npmignore delete mode 100644 packages/artplayer-tool-github/.npmrc delete mode 100644 packages/artplayer-tool-github/README.md delete mode 100644 packages/artplayer-tool-github/dist/artplayer-tool-github.js delete mode 100644 packages/artplayer-tool-github/package.json delete mode 100644 packages/artplayer-tool-github/src/index.js diff --git a/docs/assets/example/backlight.js b/docs/assets/example/backlight.js deleted file mode 100644 index 0583aa641..000000000 --- a/docs/assets/example/backlight.js +++ /dev/null @@ -1,21 +0,0 @@ -var art = new Artplayer({ - container: '.artplayer-app', - url: '/assets/sample/video.mp4', - autoSize: true, - light: true, - localVideo: true, - moreVideoAttr: { - crossOrigin: 'anonymous', - }, - controls: [ - { - name: 'open', - position: 'right', - html: 'Local Video', - mounted: $open => { - art.plugins.localVideo.attach($open); - }, - }, - ], - plugins: [artplayerPluginBacklight], -}); diff --git a/docs/assets/example/github.js b/docs/assets/example/github.js deleted file mode 100644 index 906262be0..000000000 --- a/docs/assets/example/github.js +++ /dev/null @@ -1,68 +0,0 @@ -// 使用 Github Issues Api 做弹幕接口 -// 接口每小时限制 5000 次请求,勿滥用 -var danmuku = new ArtplayerToolGithub({ - api: 'zhw2590582/github-issues-api-as-danmuku/issues/1', - clientID: '749a95aad589f8849abe', - clientSecret: '7bb6fa67ef6e525e5bd5fda46cd3925ecc4a3760', -}); - -var art = new Artplayer({ - container: '.artplayer-app', - url: '/assets/sample/video.mp4', - autoSize: true, - controls: [ - { - name: 'danmuku', - position: 'right', - html: '发送弹幕', - click: () => { - if (window.location.href.includes('code=')) { - art.notice.show = '正在登陆中,请稍等!!!'; - } else if (!danmuku.isLogin) { - danmuku.login(); - } else { - var text = prompt('请输入:', '弹幕内容'); - if (!text || !text.trim()) return; - if (text.length >= 20) { - art.notice.show = '弹幕字数不能大于20字!!!'; - return; - } - if (danmuku.remaining <= 10) { - art.notice.show = '接口请求到达上限,请稍后再试!!!'; - return; - } - art.notice.show = '弹幕发送中...'; - danmuku - .send({ - text: text, - time: art.player.currentTime, - color: '#' + Math.floor(Math.random() * 0xffffff).toString(16), - }) - .then(data => { - art.notice.show = `发送弹幕成功: ${danmuku.remaining} / ${danmuku.limit}`; - art.plugins.artplayerPluginDanmuku.emit({ - ...data, - mode: 0, - time: art.player.currentTime + 0.2, - border: true, - }); - }) - .catch(() => { - art.notice.show = `发送弹幕失败: ${danmuku.remaining} / ${danmuku.limit}`; - }); - } - }, - }, - ], - plugins: [ - artplayerPluginDanmuku({ - danmuku: () => danmuku.load(), - speed: 5, - opacity: 1, - color: '#fff', - size: 25, - maxlength: 50, - margin: [10, 100], - }), - ], -}); diff --git a/docs/assets/js/ssr.js b/docs/assets/js/ssr.js deleted file mode 100644 index 3b92c1071..000000000 --- a/docs/assets/js/ssr.js +++ /dev/null @@ -1,132 +0,0 @@ -const $container = document.querySelector('.artplayer-app'); - -// 在服务器端可以直接访问 Artplayer.html 属性,返回供 ssr 使用的 html -// 然后直接插值于播放器的容器里 -// const Artplayer = require('artplayer'); -// console.log(Artplayer.html); -// 在浏览器端,开启 useSSR 即可 - -// 模拟效果 -$container.innerHTML = Artplayer.html; - -var art = new Artplayer({ - useSSR: true, - container: $container, - url: 'https://artplayer.org/assets/sample/video.mp4', - title: 'One More Time One More Chance', - poster: '/assets/sample/poster.jpg', - volume: 0.5, - isLive: false, - muted: false, - autoplay: false, - pip: true, - autoSize: true, - autoMini: true, - screenshot: true, - setting: true, - loop: true, - flip: true, - rotate: true, - playbackRate: true, - aspectRatio: true, - fullscreen: true, - fullscreenWeb: true, - subtitleOffset: true, - miniProgressBar: true, - localVideo: true, - localSubtitle: true, - networkMonitor: false, - mutex: true, - light: true, - backdrop: true, - log: true, - theme: '#ffad00', - lang: navigator.language.toLowerCase(), - moreVideoAttr: { - crossOrigin: 'anonymous', - }, - contextmenu: [ - { - html: 'Custom menu', - click: function (contextmenu) { - console.info('You clicked on the custom menu'); - contextmenu.show = false; - }, - }, - ], - layers: [ - { - html: ``, - click: function () { - console.info('You clicked on the custom layer'); - }, - style: { - position: 'absolute', - top: '20px', - right: '20px', - opacity: '.9', - }, - }, - ], - quality: [ - { - default: true, - name: 'SD 480P', - url: '/assets/sample/video.mp4', - }, - { - name: 'HD 720P', - url: '/assets/sample/video.mp4', - }, - ], - thumbnails: { - url: '/assets/sample/thumbnails.png', - number: 100, - width: 160, - height: 90, - column: 10, - }, - subtitle: { - url: '/assets/sample/subtitle.srt', - style: { - color: '#03A9F4', - }, - encoding: 'utf-8', - bilingual: true, - }, - highlight: [ - { - time: 60, - text: 'One more chance', - }, - { - time: 120, - text: '谁でもいいはずなのに', - }, - { - time: 180, - text: '夏の想い出がまわる', - }, - { - time: 240, - text: 'こんなとこにあるはずもないのに', - }, - { - time: 300, - text: '终わり', - }, - ], - controls: [ - { - position: 'right', - html: 'Control', - click: function () { - console.info('You clicked on the custom control'); - }, - }, - ], - icons: { - loading: '', - state: '', - }, -}); diff --git a/docs/index.html b/docs/index.html index edcc02af4..1f8a8b533 100644 --- a/docs/index.html +++ b/docs/index.html @@ -30,18 +30,12 @@
  • artplayer-plugin-danmuku
  • -
  • - artplayer-plugin-backlight -
  • diff --git a/docs/ssr.html b/docs/ssr.html deleted file mode 100644 index 935e5a727..000000000 --- a/docs/ssr.html +++ /dev/null @@ -1,60 +0,0 @@ - - - - - - Artplayer.js - - - - - - - - - - -
    -
    -
    - - - - - - \ No newline at end of file diff --git a/packages/artplayer-plugin-backlight/.npmignore b/packages/artplayer-plugin-backlight/.npmignore deleted file mode 100644 index 429145126..000000000 --- a/packages/artplayer-plugin-backlight/.npmignore +++ /dev/null @@ -1,9 +0,0 @@ -node_modules -.DS_Store -yarn.lock -package-lock.json -test -coverage -.nyc_output -.cache -docs \ No newline at end of file diff --git a/packages/artplayer-plugin-backlight/.npmrc b/packages/artplayer-plugin-backlight/.npmrc deleted file mode 100644 index 9cf949503..000000000 --- a/packages/artplayer-plugin-backlight/.npmrc +++ /dev/null @@ -1 +0,0 @@ -package-lock=false \ No newline at end of file diff --git a/packages/artplayer-plugin-backlight/README.md b/packages/artplayer-plugin-backlight/README.md deleted file mode 100644 index 66bdee3c3..000000000 --- a/packages/artplayer-plugin-backlight/README.md +++ /dev/null @@ -1,47 +0,0 @@ -# artplayer-plugin-backlight - -Backlight plugin for ArtPlayer - -## Demo - -[Checkout the demo](https://artplayer.org/?libs=.%2Funcompiled%2Fartplayer-plugin-backlight.js&example=backlight) from Github Pages - -## Install - -Install with `npm` - -```bash -$ npm install artplayer-plugin-backlight -``` - -Or install with `yarn` - -```bash -$ yarn add artplayer-plugin-backlight -``` - -```js -import artplayerPluginBacklight from 'artplayer-plugin-backlight'; -``` - -Or umd builds are also available - -```html - -``` - -Will expose the global variable to `window.artplayerPluginBacklight`. - -## Usage - -```js -var art = new Artplayer({ - container: '.artplayer-app', - url: 'path/to/video.mp4', - plugins: [artplayerPluginBacklight], -}); -``` - -## License - -MIT © [Harvey Zack](https://sleepy.im/) diff --git a/packages/artplayer-plugin-backlight/dist/artplayer-plugin-backlight.js b/packages/artplayer-plugin-backlight/dist/artplayer-plugin-backlight.js deleted file mode 100644 index 1a026168f..000000000 --- a/packages/artplayer-plugin-backlight/dist/artplayer-plugin-backlight.js +++ /dev/null @@ -1,8 +0,0 @@ -/*! - * artplayer-plugin-backlight.js v4.0.0 - * Github: https://github.com/zhw2590582/ArtPlayer#readme - * (c) 2017-2021 Harvey Zack - * Released under the MIT License. - */ - -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).artplayerPluginBacklight=e()}(this,(function(){"use strict";function t(t){for(var e=[],o=0;o<10;o+=1)for(var n=0;n<5;n+=1)0!==o&&9!==o&&0!==n&&4!==n||e.push(t(o,n,10,5));return e}return function(e){var o=e.constructor.utils.setStyles,n=e.template,a=n.$player,i=n.$video,r=e.player,c=document.createElement("div");c.classList.add("artplayer-backlight"),o(c,{position:"absolute",zIndex:9,left:0,top:0,right:0,bottom:0,width:"100%",height:"100%"});var l,s=(l=c,t((function(t,e,o,n){var a=document.createElement("div");return a.style.position="absolute",a.style.left="".concat(100*t/o,"%"),a.style.top="".concat(100*e/n,"%"),a.style.width="".concat(100/o,"%"),a.style.height="".concat(100/n,"%"),a.style.webkitBorderRadius="50%",a.style.borderRadius="50%",a.style.webkitTransition="all .2s ease",a.style.transition="all .2s ease",l.appendChild(a),{$box:a,left:0===t,right:t===o-1,top:0===e,bottom:e===n-1}}))),u=document.createElement("canvas");return a.insertBefore(c,i),function o(){setTimeout((function(){if(r.playing){var n=i.clientWidth,a=i.clientHeight,c=function(e,o,n,a){var i=e.getContext("2d");return e.width=n,e.height=a,i.drawImage(o,0,0),t((function(t,e,o,r){for(var c=n/o,l=a/r,s=t*c,u=e*l,d=i.getImageData(s,u,c,l).data,f=0,h=0,p=0,g=0,y=d.length;g", - "license": "MIT", - "bugs": { - "url": "https://github.com/zhw2590582/ArtPlayer/issues" - }, - "homepage": "https://github.com/zhw2590582/ArtPlayer#readme", - "gitHead": "5ea211ef738351668e4acace326af4ff6947e2ee" -} diff --git a/packages/artplayer-plugin-backlight/src/index.js b/packages/artplayer-plugin-backlight/src/index.js deleted file mode 100644 index ee5403068..000000000 --- a/packages/artplayer-plugin-backlight/src/index.js +++ /dev/null @@ -1,115 +0,0 @@ -function matrixCallback(callback) { - const result = []; - const x = 10; - const y = 5; - for (let xIndex = 0; xIndex < x; xIndex += 1) { - for (let yIndex = 0; yIndex < y; yIndex += 1) { - if (xIndex === 0 || xIndex === x - 1 || yIndex === 0 || yIndex === y - 1) { - result.push(callback(xIndex, yIndex, x, y)); - } - } - } - return result; -} - -function getColors($canvas, $video, width, height) { - const ctx = $canvas.getContext('2d'); - $canvas.width = width; - $canvas.height = height; - ctx.drawImage($video, 0, 0); - return matrixCallback((xIndex, yIndex, x, y) => { - const itemW = width / x; - const itemH = height / y; - const itemX = xIndex * itemW; - const itemY = yIndex * itemH; - const { data } = ctx.getImageData(itemX, itemY, itemW, itemH); - let r = 0; - let g = 0; - let b = 0; - for (let i = 0, l = data.length; i < l; i += 4) { - r += data[i]; - g += data[i + 1]; - b += data[i + 2]; - } - r = Math.floor(r / (data.length / 4)); - g = Math.floor(g / (data.length / 4)); - b = Math.floor(b / (data.length / 4)); - return { r, g, b }; - }); -} - -function creatMatrix(parent) { - return matrixCallback((xIndex, yIndex, x, y) => { - const $box = document.createElement('div'); - $box.style.position = 'absolute'; - $box.style.left = `${(xIndex * 100) / x}%`; - $box.style.top = `${(yIndex * 100) / y}%`; - $box.style.width = `${100 / x}%`; - $box.style.height = `${100 / y}%`; - $box.style.webkitBorderRadius = '50%'; - $box.style.borderRadius = '50%'; - $box.style.webkitTransition = 'all .2s ease'; - $box.style.transition = 'all .2s ease'; - parent.appendChild($box); - return { - $box, - left: xIndex === 0, - right: xIndex === x - 1, - top: yIndex === 0, - bottom: yIndex === y - 1, - }; - }); -} - -function artplayerPluginBacklight(art) { - const { setStyles } = art.constructor.utils; - const { - template: { $player, $video }, - player, - } = art; - - const $backlight = document.createElement('div'); - $backlight.classList.add('artplayer-backlight'); - setStyles($backlight, { - position: 'absolute', - zIndex: 9, - left: 0, - top: 0, - right: 0, - bottom: 0, - width: '100%', - height: '100%', - }); - - const matrix = creatMatrix($backlight); - const $canvas = document.createElement('canvas'); - $player.insertBefore($backlight, $video); - - (function loop() { - setTimeout(() => { - if (player.playing) { - const { clientWidth, clientHeight } = $video; - const colors = getColors($canvas, $video, clientWidth, clientHeight); - colors.forEach(({ r, g, b }, index) => { - const { $box, left, right, top, bottom } = matrix[index]; - // eslint-disable-next-line no-nested-ternary - const x = left ? '-64px' : right ? '64px' : '0'; - // eslint-disable-next-line no-nested-ternary - const y = top ? '-64px' : bottom ? '64px' : '0'; - $box.style.webkitBoxShadow = `rgb(${r}, ${g}, ${b}) ${x} ${y} 128px`; - $box.style.boxShadow = `rgb(${r}, ${g}, ${b}) ${x} ${y} 128px`; - }); - } - - if (!art.isDestroy) { - loop(); - } - }, 200); - })(); - - return { - name: 'artplayerPluginBacklight', - }; -} - -export default artplayerPluginBacklight; diff --git a/packages/artplayer-tool-github/.npmignore b/packages/artplayer-tool-github/.npmignore deleted file mode 100644 index 429145126..000000000 --- a/packages/artplayer-tool-github/.npmignore +++ /dev/null @@ -1,9 +0,0 @@ -node_modules -.DS_Store -yarn.lock -package-lock.json -test -coverage -.nyc_output -.cache -docs \ No newline at end of file diff --git a/packages/artplayer-tool-github/.npmrc b/packages/artplayer-tool-github/.npmrc deleted file mode 100644 index 9cf949503..000000000 --- a/packages/artplayer-tool-github/.npmrc +++ /dev/null @@ -1 +0,0 @@ -package-lock=false \ No newline at end of file diff --git a/packages/artplayer-tool-github/README.md b/packages/artplayer-tool-github/README.md deleted file mode 100644 index 93720cde6..000000000 --- a/packages/artplayer-tool-github/README.md +++ /dev/null @@ -1,37 +0,0 @@ -# artplayer-plugin-github - -Danmu plugin for ArtPlayer - -## Demo - -[Checkout the demo](https://artplayer.org/?libs=./uncompiled/artplayer-tool-github.js%0A./uncompiled/artplayer-plugin-danmuku.js&example=github) from Github Pages - -## Install - -Install with `npm` - -```bash -$ npm install artplayer-plugin-github -``` - -Or install with `yarn` - -```bash -$ yarn add artplayer-plugin-github -``` - -```js -import ArtplayerToolGithub from 'artplayer-plugin-github'; -``` - -Or umd builds are also available - -```html - -``` - -Will expose the global variable to `window.ArtplayerToolGithub`. - -## License - -MIT © [Harvey Zack](https://sleepy.im/) diff --git a/packages/artplayer-tool-github/dist/artplayer-tool-github.js b/packages/artplayer-tool-github/dist/artplayer-tool-github.js deleted file mode 100644 index ea6ea12e3..000000000 --- a/packages/artplayer-tool-github/dist/artplayer-tool-github.js +++ /dev/null @@ -1,8 +0,0 @@ -/*! - * artplayer-tool-github.js v4.0.0 - * Github: https://github.com/zhw2590582/ArtPlayer#readme - * (c) 2017-2021 Harvey Zack - * Released under the MIT License. - */ - -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).ArtplayerToolGithub=e()}(this,(function(){"use strict";"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;var t={exports:{}};return function(t,e){t.exports=function(){var t,e=function(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t},r=function(t){for(var r=1;r", - "license": "MIT", - "bugs": { - "url": "https://github.com/zhw2590582/ArtPlayer/issues" - }, - "homepage": "https://github.com/zhw2590582/ArtPlayer#readme", - "dependencies": { - "issues-danmuku": "latest" - }, - "gitHead": "5ea211ef738351668e4acace326af4ff6947e2ee" -} diff --git a/packages/artplayer-tool-github/src/index.js b/packages/artplayer-tool-github/src/index.js deleted file mode 100644 index eaad309c8..000000000 --- a/packages/artplayer-tool-github/src/index.js +++ /dev/null @@ -1,3 +0,0 @@ -import ArtplayerToolGithub from 'issues-danmuku'; - -export default ArtplayerToolGithub; \ No newline at end of file