eplayer 1.5.11 → 1.5.13

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
@@ -6,13 +6,14 @@ class Eplayer extends HTMLElement {
6
6
  this.type = this.getAttribute('type')
7
7
  this.beatmap = this.getAttribute('beatmap')
8
8
  this.height = this.getAttribute('height')
9
+ this.live = JSON.parse(this.getAttribute('live'))
9
10
 
10
11
  this.init()
11
12
  this.stream()
12
13
  }
13
14
 
14
15
  static get observedAttributes() {
15
- return ['src', 'type', 'beatmap', 'height']
16
+ return ['src', 'type', 'beatmap', 'height','live']
16
17
  }
17
18
 
18
19
  attributeChangedCallback(name, _, newVal) {
@@ -20,6 +21,7 @@ class Eplayer extends HTMLElement {
20
21
  if (name === 'type') this.type = newVal
21
22
  if (name === 'beatmap') this.beatmap = newVal
22
23
  if (name === 'height') this.height = newVal
24
+ if (name === 'live') this.live = JSON.parse(newVal)
23
25
  this.stream()
24
26
  this.startMug()
25
27
  this.video.load()
@@ -92,11 +94,11 @@ class Eplayer extends HTMLElement {
92
94
  volume() {
93
95
  if (this.video.muted) {
94
96
  this.video.muted = false
95
- setVolume(this.video.volume * 10, this.$('.line'))
97
+
96
98
  this.$('.is-volume').classList.replace('ep-volume-off', 'ep-volume')
97
99
  } else {
98
100
  this.video.muted = true
99
- setVolume(0, this.$('.line'))
101
+
100
102
  this.$('.is-volume').classList.replace('ep-volume', 'ep-volume-off')
101
103
  }
102
104
  }
@@ -119,10 +121,10 @@ class Eplayer extends HTMLElement {
119
121
 
120
122
  down(e) {
121
123
  this.disX = e.clientX - this.$('.cycle').offsetLeft
122
- document.onmousemove = (e) => this.move(e)
123
- document.onmouseup = () => {
124
- document.onmousemove = null
125
- document.onmouseup = null
124
+ document.onpointermove = (e) => this.move(e)
125
+ document.onpointerup = () => {
126
+ document.onpointermove = null
127
+ document.onpointerup = null
126
128
  }
127
129
  }
128
130
 
@@ -134,8 +136,8 @@ class Eplayer extends HTMLElement {
134
136
  }
135
137
  this.$('.current').style.width = offset + 'px'
136
138
  this.video.currentTime = (offset / this.$('.progress').clientWidth) * this.video.duration
137
- document.onmousemove = null
138
- setTimeout((document.onmousemove = (e) => e && this.move(e)), 30)
139
+ document.onpointermove = null
140
+ setTimeout((document.onpointermove = (e) => e && this.move(e)), 30)
139
141
  }
140
142
 
141
143
  alow() {
@@ -162,13 +164,11 @@ class Eplayer extends HTMLElement {
162
164
  try {
163
165
  this.video.volume = parseInt(this.video.volume * 100) / 100 + 0.05
164
166
  } catch (e) { }
165
- setVolume(this.video.volume.toFixed(1) * 10, this.$('.line'))
166
167
  break
167
168
  case 40:
168
169
  try {
169
170
  this.video.volume = parseInt(this.video.volume * 100) / 100 - 0.05
170
171
  } catch (e) { }
171
- setVolume(this.video.volume.toFixed(1) * 10, this.$('.line'))
172
172
  break
173
173
  case 32:
174
174
  this.play()
@@ -192,10 +192,13 @@ class Eplayer extends HTMLElement {
192
192
  } else if (document.msExitFullscreen) {
193
193
  document.msExitFullscreen()
194
194
  }
195
+
196
+ screen.orientation.lock("portrait-primary")
195
197
  } else {
196
198
  let el = this.$('.eplayer')
197
199
  let rfs = el.requestFullScreen || el.webkitRequestFullScreen || el.mozRequestFullScreen || el.msRequestFullscreen
198
- return rfs.call(el)
200
+ rfs.call(el)
201
+ screen.orientation.lock("landscape-primary")
199
202
  }
200
203
  }
201
204
 
@@ -234,7 +237,7 @@ class Eplayer extends HTMLElement {
234
237
  // console.log(this.beatmap)
235
238
  let html = `
236
239
  <style>
237
- @import "https://at.alicdn.com/t/font_836948_g9fk6jqpl8l.css";
240
+ @import "https://at.alicdn.com/t/c/font_836948_ro9xopmggai.css";
238
241
  *{
239
242
  padding:0;
240
243
  margin:0;
@@ -266,6 +269,7 @@ class Eplayer extends HTMLElement {
266
269
  z-index:1;
267
270
  }
268
271
  .progress{
272
+ display:${this.live?'none':'block'};
269
273
  position:relative;
270
274
  bottom:15px;
271
275
  left:0;
@@ -289,6 +293,7 @@ class Eplayer extends HTMLElement {
289
293
  color:#fff;
290
294
  }
291
295
  .time{
296
+ display:${this.live?'none':'inline-block'};
292
297
  position:relative;
293
298
  top:-2px;
294
299
  }
@@ -479,18 +484,6 @@ class Eplayer extends HTMLElement {
479
484
  </div>
480
485
  <div class="right">
481
486
  <i class="epicon ep-volume is-volume"></i>
482
- <ol class="lines">
483
- <span class="line"><i></i></span>
484
- <span class="line"><i></i></span>
485
- <span class="line"><i></i></span>
486
- <span class="line"><i></i></span>
487
- <span class="line"><i></i></span>
488
- <span class="line"><i></i></span>
489
- <span class="line"><i></i></span>
490
- <span class="line"><i></i></span>
491
- <span class="line"><i></i></span>
492
- <span class="line"><i></i></span>
493
- </ol>
494
487
  <i class="epicon ep-speed">
495
488
  <b class="speed">1x</b>
496
489
  </i>
@@ -578,7 +571,7 @@ class Eplayer extends HTMLElement {
578
571
  this.video = this.$('.video')
579
572
  this.mug = this.$('.mug')
580
573
  this.video.volume = 0.5
581
- setVolume(this.video.volume * 10, this.$('.line'))
574
+ // setVolume(this.video.volume * 10, this.$('.line'))
582
575
  this.video.onwaiting = this.waiting.bind(this)
583
576
  this.video.oncanplay = this.canplay.bind(this)
584
577
  this.video.ontimeupdate = this.update.bind(this)
@@ -594,7 +587,7 @@ class Eplayer extends HTMLElement {
594
587
  '.buffer': this.progress,
595
588
  '.ep-pip': this.pip,
596
589
  })
597
- this.delegate('mousedown', {
590
+ this.delegate('pointerdown', {
598
591
  '.cycle': this.down,
599
592
  '.mark': this.panel,
600
593
  })
@@ -605,13 +598,7 @@ class Eplayer extends HTMLElement {
605
598
  },
606
599
  })
607
600
  this.delegate('keydown', this.keydown)
608
- this.delegate('mousemove', this.alow)
609
- this.$('.line').forEach((item, index) => {
610
- item.onclick = () => {
611
- this.video.volume = (index + 1) / 10
612
- setVolume(index + 1, this.$('.line'))
613
- }
614
- })
601
+ this.delegate('pointerdown', this.alow)
615
602
  this.$('.eplayer').oncontextmenu = () => false
616
603
  }
617
604
  }
@@ -632,15 +619,6 @@ function getTimeStr(time) {
632
619
  return h === '00' ? m + ':' + s : h + ':' + m + ':' + s
633
620
  }
634
621
 
635
- function setVolume(index, node) {
636
- for (let j = index; j < node.length; j++) {
637
- node[j].classList.remove('active')
638
- }
639
- for (let i = 0; i < index; i++) {
640
- node[i].classList.add('active')
641
- }
642
- }
643
-
644
622
  function isFullScreen() {
645
623
  return document.isFullScreen || document.webkitIsFullScreen || document.mozIsFullScreen
646
624
  }
package/docs/index.html CHANGED
@@ -27,8 +27,7 @@
27
27
  @media screen and (max-width: 500px) {
28
28
  .wrapper {
29
29
  width: 100%;
30
- margin: 100px auto;
31
- max-height: 200px;
30
+ transform: translate(-50%, 0)!important;
32
31
  }
33
32
  }
34
33
 
@@ -109,7 +108,9 @@
109
108
  </script>
110
109
  <div class="wrapper">
111
110
 
112
- <e-player id="ep" src="https://mp4.ziyuan.wang/view.php/67c796ed2dad70c429bda73a647704f0.mp4">
111
+ <e-player id="ep"
112
+ src="https://a1.alibabausercontent.com/prod/feupload/user/edos8/2f0e7af0-29f1-11ef-b3cd-818e64ac843d.mp4"
113
+ live="false">
113
114
  </e-player>
114
115
 
115
116
  <a href="https://github.com/132yse/eplayer">github</a>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eplayer",
3
- "version": "1.5.11",
3
+ "version": "1.5.13",
4
4
  "description": "A web-components html5 video player facing future",
5
5
  "main": "./docs/eplayer.js",
6
6
  "module": "./docs/eplayer.js",