eplayer 1.6.0 → 1.6.1
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/docs/danmaku.js +2 -9
- package/docs/eplayer.js +27 -29
- package/package.json +1 -1
package/docs/danmaku.js
CHANGED
|
@@ -231,8 +231,6 @@ class Danmaku {
|
|
|
231
231
|
count--
|
|
232
232
|
}
|
|
233
233
|
}
|
|
234
|
-
|
|
235
|
-
|
|
236
234
|
// 轮询结束后,根据队列长度继续执行或停止执行
|
|
237
235
|
_renderEnd() {
|
|
238
236
|
if (this._queue.length > 0) {
|
|
@@ -245,12 +243,6 @@ class Danmaku {
|
|
|
245
243
|
}
|
|
246
244
|
|
|
247
245
|
pause() {
|
|
248
|
-
if (this._resumeTimer) { clearTimeout(this._resumeTimer) }
|
|
249
|
-
if (this._renderTimer) {
|
|
250
|
-
clearTimeout(this._renderTimer)
|
|
251
|
-
this._renderTimer = null
|
|
252
|
-
}
|
|
253
|
-
|
|
254
246
|
if (this._paused) { return }
|
|
255
247
|
this._paused = true
|
|
256
248
|
|
|
@@ -258,7 +250,8 @@ class Danmaku {
|
|
|
258
250
|
const data = this._findData(y, id)
|
|
259
251
|
if (data) {
|
|
260
252
|
// 获取已滚动距离
|
|
261
|
-
|
|
253
|
+
const transform = getComputedStyle(node, null).getPropertyValue('transform')
|
|
254
|
+
data.rolledDistance = -Number(new DOMMatrix(transform).m41)
|
|
262
255
|
|
|
263
256
|
// 移除动画,计算出弹幕所在的位置,固定样式
|
|
264
257
|
node.style.transition = ''
|
package/docs/eplayer.js
CHANGED
|
@@ -85,7 +85,7 @@ class Eplayer extends HTMLElement {
|
|
|
85
85
|
this.$('.is-play').classList.replace('ep-play', 'ep-pause')
|
|
86
86
|
} else {
|
|
87
87
|
this.video.pause()
|
|
88
|
-
this.danmaku.
|
|
88
|
+
this.danmaku.pause()
|
|
89
89
|
this.$('.ep-video').style.display = 'block'
|
|
90
90
|
this.$('.is-play').classList.replace('ep-pause', 'ep-play')
|
|
91
91
|
}
|
|
@@ -443,10 +443,6 @@ class Eplayer extends HTMLElement {
|
|
|
443
443
|
display:inline-block;
|
|
444
444
|
}
|
|
445
445
|
|
|
446
|
-
.wrap{
|
|
447
|
-
position: relative;
|
|
448
|
-
}
|
|
449
|
-
|
|
450
446
|
.danmaku {
|
|
451
447
|
position: absolute;
|
|
452
448
|
top: 0;
|
|
@@ -456,11 +452,13 @@ class Eplayer extends HTMLElement {
|
|
|
456
452
|
pointer-events: none;
|
|
457
453
|
overflow: hidden;
|
|
458
454
|
z-index: 999;
|
|
455
|
+
height:100%;
|
|
456
|
+
width:100%;
|
|
459
457
|
}
|
|
460
458
|
</style>
|
|
461
|
-
|
|
462
|
-
<div class="danmaku"></div>
|
|
459
|
+
|
|
463
460
|
<div class="eplayer">
|
|
461
|
+
<div class="danmaku"></div>
|
|
464
462
|
<video id="video" class="video" src="${this.src || ''}"></video>
|
|
465
463
|
<div class="mark loading"></div>
|
|
466
464
|
<div class="controls" style="bottom:-70px">
|
|
@@ -492,7 +490,6 @@ class Eplayer extends HTMLElement {
|
|
|
492
490
|
<div class="epicon ep-video"></div>
|
|
493
491
|
<div class="panel"></div>
|
|
494
492
|
</div>
|
|
495
|
-
</div>
|
|
496
493
|
`
|
|
497
494
|
let template = document.createElement('template')
|
|
498
495
|
template.innerHTML = html
|
|
@@ -534,7 +531,7 @@ class Eplayer extends HTMLElement {
|
|
|
534
531
|
let dom = this.shadowRoot.querySelectorAll(key)
|
|
535
532
|
this.doms[key] = dom.length > 1 ? [...dom] : dom[0]
|
|
536
533
|
}
|
|
537
|
-
|
|
534
|
+
|
|
538
535
|
|
|
539
536
|
for (const name in Eplayer.plugins) {
|
|
540
537
|
const cb = Eplayer.plugins[name]
|
|
@@ -546,26 +543,7 @@ class Eplayer extends HTMLElement {
|
|
|
546
543
|
}
|
|
547
544
|
}
|
|
548
545
|
|
|
549
|
-
|
|
550
|
-
const that = this
|
|
551
|
-
if (typeof map === 'function') {
|
|
552
|
-
this.shadowRoot.addEventListener(type, map.bind(that))
|
|
553
|
-
} else {
|
|
554
|
-
this.shadowRoot.addEventListener(type, (e) => {
|
|
555
|
-
for (const key in map) e.target.matches(key) && map[key].call(that, e)
|
|
556
|
-
})
|
|
557
|
-
}
|
|
558
|
-
}
|
|
559
|
-
|
|
560
|
-
pip(e) {
|
|
561
|
-
if (!document.pictureInPictureElement) {
|
|
562
|
-
this.video.requestPictureInPicture()
|
|
563
|
-
} else {
|
|
564
|
-
document.exitPictureInPicture()
|
|
565
|
-
}
|
|
566
|
-
}
|
|
567
|
-
|
|
568
|
-
mount() {
|
|
546
|
+
connectedCallback() {
|
|
569
547
|
this.video = this.$('.video')
|
|
570
548
|
this.video.volume = 0.5
|
|
571
549
|
this.danmaku = new Danmaku({
|
|
@@ -601,6 +579,26 @@ class Eplayer extends HTMLElement {
|
|
|
601
579
|
this.delegate('pointerdown', this.alow)
|
|
602
580
|
this.$('.eplayer').oncontextmenu = () => false
|
|
603
581
|
}
|
|
582
|
+
|
|
583
|
+
delegate(type, map) {
|
|
584
|
+
const that = this
|
|
585
|
+
if (typeof map === 'function') {
|
|
586
|
+
this.shadowRoot.addEventListener(type, map.bind(that))
|
|
587
|
+
} else {
|
|
588
|
+
this.shadowRoot.addEventListener(type, (e) => {
|
|
589
|
+
for (const key in map) e.target.matches(key) && map[key].call(that, e)
|
|
590
|
+
})
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
pip(e) {
|
|
595
|
+
if (!document.pictureInPictureElement) {
|
|
596
|
+
this.video.requestPictureInPicture()
|
|
597
|
+
} else {
|
|
598
|
+
document.exitPictureInPicture()
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
|
|
604
602
|
}
|
|
605
603
|
|
|
606
604
|
Eplayer.plugins = {}
|