eplayer 1.6.9 → 1.6.11

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 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
 
@@ -94,13 +96,13 @@ class Eplayer extends HTMLElement {
94
96
  if (this.video.paused) {
95
97
  this.video.play()
96
98
  this.danmaku.resume()
97
- this.$('.img-container').classList.add('is-playing');
99
+ this.$('.img-container').classList.add('is-playing')
98
100
  this.$('.is-play').setAttribute('icon-id', 'pause')
99
101
  this.emit('play')
100
102
  } else {
101
103
  this.video.pause()
102
104
  this.danmaku.pause()
103
- this.$('.img-container').classList.remove('is-playing');
105
+ this.$('.img-container').classList.remove('is-playing')
104
106
  this.$('.is-play').setAttribute('icon-id', 'play')
105
107
  this.emit('pause')
106
108
  }
@@ -327,6 +329,7 @@ class Eplayer extends HTMLElement {
327
329
  }
328
330
 
329
331
  init() {
332
+ console.log(this.cover)
330
333
  let html = `
331
334
  <style>
332
335
  @import "https://at.alicdn.com/t/c/font_836948_ro9xopmggai.css";
@@ -541,17 +544,17 @@ class Eplayer extends HTMLElement {
541
544
  .eplayer .img-container{
542
545
  position: absolute;
543
546
  z-index: 1;
544
- width:250px;
545
- height:250px;
546
- border-radius:125px;
547
+ height:60%;
548
+ aspect-ratio: 1/1;
549
+ border-radius:50%;
547
550
  left:50%;
548
551
  top:50%;
549
552
  transform:translate(-50%,-50%);
550
553
  }
551
554
 
552
555
  .rotate-img {
553
- width: 250px;
554
- height: 250px;
556
+ aspect-ratio: 1/1;
557
+ height: 100%;
555
558
  border-radius: 50%;
556
559
  animation: rotate 10s linear infinite;
557
560
  object-fit: cover;
@@ -629,10 +632,10 @@ class Eplayer extends HTMLElement {
629
632
  </div>
630
633
  <div class="right">
631
634
  <em class="speed">1x</em>
632
- <em class="pip">画中画</em>
635
+ ${this.cover ? `<em class="pip">画中画</em>`:''}
633
636
  <iconpark-icon icon-id="volume-ok" size="2rem" class="is-volume"></iconpark-icon>
634
- <iconpark-icon icon-id="web-fullscreen" size="2rem"></iconpark-icon>
635
- <iconpark-icon icon-id="fullscreen" size="2rem" class="fullscreen"></iconpark-icon>
637
+ ${this.cover ? `<iconpark-icon icon-id="web-fullscreen" size="2rem"></iconpark-icon>`:''}
638
+ ${this.cover ?`<iconpark-icon icon-id="fullscreen" size="2rem" class="fullscreen"></iconpark-icon>`:""}
636
639
  </div>
637
640
  </div>
638
641
  </div>
@@ -669,7 +672,9 @@ class Eplayer extends HTMLElement {
669
672
  '.speed',
670
673
  '.pip',
671
674
  '.danmaku',
672
- '.speed-indicator'
675
+ '.speed-indicator',
676
+ '.rotate-img',
677
+ '.cover'
673
678
  ]
674
679
 
675
680
  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
- cover="https://dd-static.jd.com/ddimgp/jfs/t20261103/331442/3/18576/2295463/68da8cdcF3f9f05fd/790caba1cab6753d.png">
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
- init()
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>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eplayer",
3
- "version": "1.6.9",
3
+ "version": "1.6.11",
4
4
  "description": "A web-components html5 video player facing future",
5
5
  "main": "./docs/eplayer.js",
6
6
  "module": "./docs/eplayer.js",