eplayer 1.6.3 → 1.6.5

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.
Files changed (2) hide show
  1. package/docs/eplayer.js +20 -13
  2. package/package.json +1 -1
package/docs/eplayer.js CHANGED
@@ -100,6 +100,7 @@ class Eplayer extends HTMLElement {
100
100
  }
101
101
 
102
102
  update() {
103
+ if (this.moving) return
103
104
  let cTime = getTimeStr(this.video.currentTime)
104
105
  if (this.video.buffered.length) {
105
106
  let bufferEnd = this.video.buffered.end(this.video.buffered.length - 1)
@@ -116,19 +117,21 @@ class Eplayer extends HTMLElement {
116
117
  }
117
118
 
118
119
  down(e) {
119
- this.disX = e.clientX - this.$('.cycle').offsetLeft
120
+ this.disX = e.clientX - this.$('.dot').offsetLeft
121
+ this.moving = true
120
122
  document.onpointermove = (e) => this.move(e)
121
123
  document.onpointerup = () => {
124
+ this.moveing = false
122
125
  document.onpointermove = null
123
126
  document.onpointerup = null
124
127
  }
125
128
  }
126
129
 
127
130
  move(e) {
128
- let offset = e.clientX - this.disX + 7
131
+ let offset = e.clientX - this.disX + 12
129
132
  if (offset < 0) offset = 0
130
133
  if (offset > this.$('.progress').clientWidth) {
131
- offset = this.$('.progress').clientWidth
134
+ this.offset = this.$('.progress').clientWidth
132
135
  }
133
136
  this.$('.current').style.width = offset + 'px'
134
137
  this.video.currentTime = (offset / this.$('.progress').clientWidth) * this.video.duration
@@ -137,8 +140,13 @@ class Eplayer extends HTMLElement {
137
140
  }
138
141
 
139
142
  alow() {
140
- // this.$('.controls').style.bottom = 0
143
+ clearTimeout(this.timer)
141
144
  this.$('.mark').style.cursor = 'default'
145
+ this.$('.eplayer').classList.add('hover')
146
+ this.timer = setTimeout(() => {
147
+ this.$('.eplayer').classList.remove('hover')
148
+ this.$('.mark').style.cursor = 'none'
149
+ }, 5000)
142
150
  }
143
151
 
144
152
  keydown(e) {
@@ -218,7 +226,7 @@ class Eplayer extends HTMLElement {
218
226
  }
219
227
 
220
228
  speed(e) {
221
- this.video.playbackRate === 2 ? (this.video.playbackRate = 1) : (this.video.playbackRate = this.video.playbackRate + 0.5)
229
+ this.video.playbackRate === 3 ? (this.video.playbackRate = 1) : (this.video.playbackRate = this.video.playbackRate + 0.25)
222
230
  this.$('.speed').innerText = this.video.playbackRate + 'x'
223
231
  }
224
232
 
@@ -256,9 +264,9 @@ class Eplayer extends HTMLElement {
256
264
  bottom:-34px;
257
265
  z-index:1;
258
266
  }
259
- .eplayer:hover .controls{
267
+ .hover:hover .controls{
260
268
  bottom:0;
261
- }
269
+ }
262
270
  .progress{
263
271
  display:${this.live ? 'none' : 'block'};
264
272
  position:relative;
@@ -271,7 +279,7 @@ class Eplayer extends HTMLElement {
271
279
  .progress:hover .bg,.progress:hover .current,.progress:hover .buffer{
272
280
  height:6px;
273
281
  }
274
- .progress:hover .dot,.progress:hover .cycle{
282
+ .progress:hover .dot{
275
283
  display:block;
276
284
  }
277
285
  .options{
@@ -405,7 +413,7 @@ class Eplayer extends HTMLElement {
405
413
 
406
414
  </style>
407
415
 
408
- <div class="eplayer">
416
+ <div class="eplayer hover">
409
417
  <div class="danmaku"></div>
410
418
  <video id="video" class="video" src="${this.src || ''}"></video>
411
419
  <div class="mark loading"></div>
@@ -433,7 +441,6 @@ class Eplayer extends HTMLElement {
433
441
  </div>
434
442
  </div>
435
443
  </div>
436
- <iconpark-icon icon-id="play"></iconpark-icon>
437
444
  <div class="panel"></div>
438
445
  </div>
439
446
  `
@@ -455,7 +462,7 @@ class Eplayer extends HTMLElement {
455
462
  '.buffer',
456
463
  '.is-play',
457
464
  '.is-volume',
458
- '.cycle',
465
+ '.dot',
459
466
  '.progress',
460
467
  '.controls',
461
468
  '.line',
@@ -506,7 +513,7 @@ class Eplayer extends HTMLElement {
506
513
  '.pip': this.pip,
507
514
  })
508
515
  this.delegate('pointerdown', {
509
- '.cycle': this.down,
516
+ '.dot': this.down,
510
517
  '.mark': this.panel,
511
518
  })
512
519
  this.delegate('dblclick', {
@@ -516,7 +523,7 @@ class Eplayer extends HTMLElement {
516
523
  },
517
524
  })
518
525
  this.delegate('keydown', this.keydown)
519
- this.delegate('pointerdown', this.alow)
526
+ this.delegate('mousemove', this.alow)
520
527
  this.$('.eplayer').oncontextmenu = () => false
521
528
  }
522
529
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eplayer",
3
- "version": "1.6.3",
3
+ "version": "1.6.5",
4
4
  "description": "A web-components html5 video player facing future",
5
5
  "main": "./docs/eplayer.js",
6
6
  "module": "./docs/eplayer.js",