eplayer 1.5.2 → 1.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,13 +1,14 @@
1
1
  {
2
2
  "name": "eplayer",
3
- "version": "1.5.2",
3
+ "version": "1.5.4",
4
4
  "description": "A web-components html5 video player facing future",
5
- "main": "./packages/eplayer/index.js",
6
- "module": "./packages/eplayer/index.js",
5
+ "main": "./docs/eplayer.js",
6
+ "module": "./docs/eplayer.js",
7
7
  "unpkg": "./docs/eplayer.js",
8
8
  "scripts": {
9
9
  "test": "echo \"Error: no test specified\" && exit 1",
10
- "build": "rollup -c"
10
+ "build": "rollup -c",
11
+ "start": "serve docs"
11
12
  },
12
13
  "repository": {
13
14
  "type": "git",
@@ -19,5 +20,10 @@
19
20
  "bugs": {
20
21
  "url": "https://github.com/132yse/eplayer/issues"
21
22
  },
22
- "homepage": "https://github.com/132yse/eplayer#readme"
23
+ "homepage": "https://github.com/132yse/eplayer#readme",
24
+ "dependencies": {
25
+ "pixi-filters": "^6.0.4",
26
+ "pixi.js": "^8.1.8",
27
+ "serve": "^14.2.3"
28
+ }
23
29
  }
package/docs/pic.js DELETED
@@ -1,107 +0,0 @@
1
- var random_images_array = ["1363382418078.png",
2
- "141000167429.png",
3
- "1410001686910.png",
4
- "1410306398205.png",
5
- "1416301704148.png",
6
- "1418972601666.png",
7
- "1422254058570.png",
8
- "1422254999827.png",
9
- "1424092566613.png",
10
- "1428177826695.png",
11
- "1428177904344.png",
12
- "1428178080167.png",
13
- "1428178155255.png",
14
- "1428178187507.png",
15
- "1428254016467.png",
16
- "1428423289437.png",
17
- "1428707759205.png",
18
- "1429510703681.png",
19
- "14350958102351.png",
20
- "1435095810963.png",
21
- "1435212506997.png",
22
- "1436240851027.png",
23
- "1444797684947.png",
24
- "1444797896875.png",
25
- "1444912076567.png",
26
- "1444925656945.png",
27
- "1444932063639.png",
28
- "1445288849940.png",
29
- "1445289056206.png",
30
- "1445902711571.png",
31
- "1446055508030.png",
32
- "1446382234634.png",
33
- "1446463082730.png",
34
- "1446543984763.png",
35
- "1446567791227.png",
36
- "1446781681255.png",
37
- "1447699627084.png",
38
- "1448061734635.png",
39
- "1448184200057.png",
40
- "1448242472700.png",
41
- "1448242666775.png",
42
- "1448491901093.png",
43
- "1450726187259.png",
44
- "1448856052869.png",
45
- "1449726465401.png",
46
- "1450354879735.png",
47
- "1450722871010.png",
48
- "1450724583409.png",
49
- "1450726187259.png",
50
- "1453766877670.png",
51
- "1456435736475.png",
52
- "1456626037119.png",
53
- "1456795820199.png",
54
- "1457227943457.png",
55
- "1457343592535.png",
56
- "1457740113058.png",
57
- "1457765150963.png",
58
- "1457903809526.png",
59
- "1458107401807.png",
60
- "1458114655716.png",
61
- "1458179149667.png",
62
- "1458181302393.png",
63
- "1458378445396.png",
64
- "1458438424722.png",
65
- "1458593213144.png",
66
- "1458602218407.png",
67
- "1458689827974.png",
68
- "1458695854180.png",
69
- "1458701216283.png",
70
- "1458879883654.png",
71
- "1459005360759.png",
72
- "1459039594461.png",
73
- "1466924283295.png",
74
- "1468421480662.png",
75
- "1471262460053.png",
76
- "1471285748918.png",
77
- "1472894659994.png",
78
- "1480486527028.png",
79
- "1484879057343.png",
80
- "1486346829409.png",
81
- "1489034771085.png",
82
- "1489257402500.png",
83
- "1489281927118.png",
84
- "1489297097940.png",
85
- "1490418851494.png",
86
- "1492281060221.png",
87
- "1494909700688.png",
88
- "1506616576326.png",
89
- "1512072270390.png",
90
- "1512276789957.png",
91
- "7ckzd1.png",
92
- "e1c25e2f18430875d15fdcfbb14257e8.png",
93
- "megumin_1.png",
94
- "megumin_2.png",
95
- "nz5vnb.png",
96
- "patreon-1.png",
97
- "patreon-2.png",
98
- "patreon-3.png",
99
- "patreon-4.png"
100
- ];
101
-
102
- path = 'https://catbox.moe/pictures/qts/';
103
- var num = Math.floor( Math.random() * random_images_array.length );
104
- var img = random_images_array[ num ];
105
- var imgStr = '<img src="' + path + img + '" style="position: absolute;bottom: 0;right: 0;">';
106
-
107
- document.write(imgStr); document.close();
@@ -1,27 +0,0 @@
1
- ## danmuku.js
2
-
3
- ### Install
4
- ```
5
- yarn add danmu
6
- ```
7
-
8
- ### Use
9
-
10
- ```javascript
11
- import Danmu from 'danmu'
12
-
13
- let data = [{ value: '爱死这破站啦::>_<::', time: 0, color: '#fff' }]
14
- let dm = new Danmu(canvas, video, data)
15
- // 开飞
16
- dm.play()
17
- // 暂停
18
- dm.pause()
19
- // 添加
20
- dm.add({ value: '(⊙o⊙)…', time: 0, color: '#fff' })
21
- // 重置
22
- dm.reset()
23
- ```
24
-
25
- p.s.
26
-
27
- 请尽量统一字号,这样有利于排版算法计算,否则将会出现 Acfun 那种弹幕重叠的状态,很违和 √
@@ -1,111 +0,0 @@
1
- class Danmuku {
2
- constructor(canvas, video, data) {
3
- this.canvas = canvas
4
- this.video = video
5
- this.context = canvas.getContext('2d')
6
- this.canvas.width = video.clientWidth
7
- this.canvas.height = video.clientHeight
8
- let defaultOpts = {
9
- color: '#fff',
10
- fontSize: 20,
11
- speed: 2,
12
- data: []
13
- }
14
- Object.assign(this, defaultOpts, { data })
15
-
16
- this.paused = true
17
- this.danmuku = this.data.map(danmu => new Danmu(danmu, this))
18
-
19
- this.render()
20
- }
21
-
22
- render() {
23
- this.context.clearRect(0, 0, this.canvas.width, this.canvas.height)
24
- this.draw()
25
- if (!this.paused) {
26
- requestAnimationFrame(this.render.bind(this))
27
- }
28
- }
29
-
30
- draw() {
31
- let cTime = this.video.currentTime
32
- this.danmuku.forEach(danmu => {
33
- if (!danmu.flag && danmu.time <= cTime) {
34
- if (!danmu.once) {
35
- danmu.init()
36
- danmu.once = true
37
- }
38
- danmu.x -= danmu.speed
39
- danmu.render()
40
- if (danmu.x <= danmu.width * -1) {
41
- danmu.flag = true
42
- }
43
- }
44
- })
45
- }
46
-
47
- add(danmu) {
48
- this.danmuku.push(new Danmu(danmu, this))
49
- }
50
-
51
- play() {
52
- this.paused = false
53
- this.render()
54
- }
55
-
56
- pause() {
57
- this.paused = true
58
- }
59
-
60
- reset() {
61
- this.context.clearRect(0, 0, this.canvas.width, this.canvas.height)
62
- let cTime = this.video.currentTime
63
- this.danmuku.forEach(danmu => {
64
- danmu.flag = false
65
- if (cTime < danmu.time) {
66
- danmu.paused = false
67
- } else {
68
- danmu.flag = true
69
- }
70
- })
71
- }
72
- }
73
-
74
- class Danmu {
75
- constructor(danmu, vm) {
76
- this.danmu = danmu
77
- this.value = danmu.value
78
- this.time = danmu.time
79
- this.vm = vm
80
- }
81
-
82
- init() {
83
- this.color = this.danmu.color || this.vm.color
84
- this.fontSize = this.danmu.fontSize || this.vm.fontSize
85
- this.speed = this.danmu.speed || this.vm.speed
86
-
87
- let span = document.createElement('span')
88
- span.innerText = this.value
89
- span.style.font = this.fontSize + 'px "微软雅黑"'
90
- span.style.position = 'absolute'
91
- document.body.appendChild(span)
92
- this.width = span.clientWidth
93
- document.body.removeChild(span)
94
-
95
- this.x = this.vm.canvas.width
96
- let r = this.vm.canvas.height * Math.random()
97
- this.y = r - (r % this.fontSize)
98
-
99
- if (this.y < this.fontSize) this.y = this.fontSize
100
- if (this.y > this.vm.canvas.height - this.fontSize)
101
- this.y = this.vm.canvas.height - this.fontSize
102
- }
103
-
104
- render() {
105
- this.vm.context.font = this.fontSize + 'px "微软雅黑"'
106
- this.vm.context.fillStyle = this.color
107
- this.vm.context.fillText(this.value, this.x, this.y)
108
- }
109
- }
110
-
111
- export default Danmuku
@@ -1,12 +0,0 @@
1
- {
2
- "name": "danmu",
3
- "version": "0.0.2",
4
- "description": "```javascript\r let data = [{ value: '爱死这破站啦::>_<::', time: 0, color: '#fff' }]\r let dm = new Danmuku(canvas, video, data)\r // 开飞\r dm.play()\r // 暂停\r dm.pause()\r // 添加\r dm.add({ value: '(⊙o⊙)…', time: 0, color: '#fff' })\r // 重置\r dm.reset()\r ```",
5
- "main": "danmuku.js",
6
- "scripts": {
7
- "test": "echo \"Error: no test specified\" && exit 1"
8
- },
9
- "keywords": [],
10
- "author": "",
11
- "license": "MIT"
12
- }