eplayer 1.6.8 → 1.6.10
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/eplayer.js +78 -14
- package/docs/index.html +8 -2
- package/package.json +1 -1
package/docs/eplayer.js
CHANGED
|
@@ -21,7 +21,7 @@ class Eplayer extends HTMLElement {
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
static get observedAttributes() {
|
|
24
|
-
return ['src', 'type', 'danma', 'live']
|
|
24
|
+
return ['src', 'type', 'danma', 'live','cover']
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
attributeChangedCallback(name, oldVal, newVal) {
|
|
@@ -52,6 +52,8 @@ class Eplayer extends HTMLElement {
|
|
|
52
52
|
}
|
|
53
53
|
if (name === 'cover') {
|
|
54
54
|
this.cover = newVal
|
|
55
|
+
this.$('.rotate-img').setAttribute('src', newVal)
|
|
56
|
+
this.$('.cover').style.background=`url(${newVal || ''}) center/cover no-repeat #fff`
|
|
55
57
|
}
|
|
56
58
|
}
|
|
57
59
|
|
|
@@ -90,14 +92,17 @@ class Eplayer extends HTMLElement {
|
|
|
90
92
|
}
|
|
91
93
|
|
|
92
94
|
play() {
|
|
95
|
+
console.log(this.$('.img-container'))
|
|
93
96
|
if (this.video.paused) {
|
|
94
97
|
this.video.play()
|
|
95
98
|
this.danmaku.resume()
|
|
99
|
+
this.$('.img-container').classList.add('is-playing')
|
|
96
100
|
this.$('.is-play').setAttribute('icon-id', 'pause')
|
|
97
101
|
this.emit('play')
|
|
98
102
|
} else {
|
|
99
103
|
this.video.pause()
|
|
100
104
|
this.danmaku.pause()
|
|
105
|
+
this.$('.img-container').classList.remove('is-playing')
|
|
101
106
|
this.$('.is-play').setAttribute('icon-id', 'play')
|
|
102
107
|
this.emit('pause')
|
|
103
108
|
}
|
|
@@ -352,16 +357,7 @@ class Eplayer extends HTMLElement {
|
|
|
352
357
|
background:url(${this.cover || ''}) center/cover no-repeat #fff;
|
|
353
358
|
filter:blur(8px);
|
|
354
359
|
}
|
|
355
|
-
|
|
356
|
-
position: absolute;
|
|
357
|
-
z-index: 1;
|
|
358
|
-
width:250px;
|
|
359
|
-
height:250px;
|
|
360
|
-
border-radius:125px;
|
|
361
|
-
left:50%;
|
|
362
|
-
top:50%;
|
|
363
|
-
transform:translate(-50%,-50%);
|
|
364
|
-
}
|
|
360
|
+
|
|
365
361
|
.eplayer{
|
|
366
362
|
user-select:none;
|
|
367
363
|
position: relative;
|
|
@@ -543,14 +539,79 @@ class Eplayer extends HTMLElement {
|
|
|
543
539
|
margin:0 10px 0 8px;
|
|
544
540
|
cursor: pointer;
|
|
545
541
|
}
|
|
546
|
-
|
|
542
|
+
|
|
543
|
+
.eplayer .img-container{
|
|
544
|
+
position: absolute;
|
|
545
|
+
z-index: 1;
|
|
546
|
+
width:250px;
|
|
547
|
+
height:250px;
|
|
548
|
+
border-radius:125px;
|
|
549
|
+
left:50%;
|
|
550
|
+
top:50%;
|
|
551
|
+
transform:translate(-50%,-50%);
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
.rotate-img {
|
|
555
|
+
width: 250px;
|
|
556
|
+
height: 250px;
|
|
557
|
+
border-radius: 50%;
|
|
558
|
+
animation: rotate 10s linear infinite;
|
|
559
|
+
object-fit: cover;
|
|
560
|
+
animation-play-state: paused; /* 默认暂停 */
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
.img-container::after,
|
|
564
|
+
.img-container::before {
|
|
565
|
+
content: '';
|
|
566
|
+
position: absolute;
|
|
567
|
+
top: 50%;
|
|
568
|
+
left: 50%;
|
|
569
|
+
width: 100%;
|
|
570
|
+
height: 100%;
|
|
571
|
+
border-radius: 50%;
|
|
572
|
+
transform: translate(-50%, -50%) scale(0);
|
|
573
|
+
animation: wave 2s infinite;
|
|
574
|
+
animation-play-state: paused; /* 默认暂停 */
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
.img-container::after {
|
|
578
|
+
background: rgba(255, 255, 255, 0.3);
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
.img-container::before {
|
|
582
|
+
background: rgba(255, 255, 255, 0.2);
|
|
583
|
+
animation-delay: 1s;
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
/* 播放状态 */
|
|
587
|
+
.is-playing .rotate-img,
|
|
588
|
+
.is-playing::after,
|
|
589
|
+
.is-playing::before {
|
|
590
|
+
animation-play-state: running;
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
@keyframes rotate {
|
|
594
|
+
from { transform: rotate(0deg); }
|
|
595
|
+
to { transform: rotate(360deg); }
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
@keyframes wave {
|
|
599
|
+
0% {
|
|
600
|
+
transform: translate(-50%, -50%) scale(0);
|
|
601
|
+
opacity: 1;
|
|
602
|
+
}
|
|
603
|
+
100% {
|
|
604
|
+
transform: translate(-50%, -50%) scale(2);
|
|
605
|
+
opacity: 0;
|
|
606
|
+
}
|
|
607
|
+
}
|
|
547
608
|
</style>
|
|
548
609
|
|
|
549
610
|
<div class="eplayer hover">
|
|
550
611
|
<div class="danmaku"></div>
|
|
551
612
|
<video id="video" class="video" src="${this.src || ''}"></video>
|
|
552
613
|
<div class="cover"></div>
|
|
553
|
-
<img src="${this.cover || ''}" class="
|
|
614
|
+
<div class="img-container"><img src="${this.cover || ''}" class="rotate-img"/></div>
|
|
554
615
|
<div class="mark loading"></div>
|
|
555
616
|
<div class="speed-indicator">倍速中</div>
|
|
556
617
|
<div class="controls">
|
|
@@ -587,6 +648,7 @@ class Eplayer extends HTMLElement {
|
|
|
587
648
|
}).appendChild(template.content.cloneNode(true))
|
|
588
649
|
|
|
589
650
|
const doms = [
|
|
651
|
+
'.img-container',
|
|
590
652
|
'.video',
|
|
591
653
|
'.mark',
|
|
592
654
|
'.playing',
|
|
@@ -609,7 +671,9 @@ class Eplayer extends HTMLElement {
|
|
|
609
671
|
'.speed',
|
|
610
672
|
'.pip',
|
|
611
673
|
'.danmaku',
|
|
612
|
-
'.speed-indicator'
|
|
674
|
+
'.speed-indicator',
|
|
675
|
+
'.rotate-img',
|
|
676
|
+
'.cover'
|
|
613
677
|
]
|
|
614
678
|
|
|
615
679
|
for (const key of doms) {
|
package/docs/index.html
CHANGED
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
<div class="wrapper">
|
|
67
67
|
<e-player id="ep"
|
|
68
68
|
src="https://aod.cos.tx.xmcdn.com/storages/9976-audiofreehighqps/C9/1C/GAqhF9kMsE7kACAAAAQZZzo_.wav"
|
|
69
|
-
|
|
69
|
+
>
|
|
70
70
|
</e-player>
|
|
71
71
|
</div>
|
|
72
72
|
<script src="https://unpkg.com/@webcomponents/webcomponentsjs"></script>
|
|
@@ -98,7 +98,13 @@
|
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
-
|
|
101
|
+
setTimeout(() => {
|
|
102
|
+
console.log(123)
|
|
103
|
+
document.querySelector('e-player').setAttribute('cover','https://dd-static.jd.com/ddimgp/jfs/t20261103/331442/3/18576/2295463/68da8cdcF3f9f05fd/790caba1cab6753d.png')
|
|
104
|
+
|
|
105
|
+
}, 200);
|
|
106
|
+
|
|
107
|
+
// init()
|
|
102
108
|
</script>
|
|
103
109
|
<!-- <script src="./pic.js"></script> -->
|
|
104
110
|
</body>
|