eplayer 1.6.5 → 1.6.7

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 +11 -17
  2. package/package.json +1 -1
package/docs/eplayer.js CHANGED
@@ -6,6 +6,7 @@ class Eplayer extends HTMLElement {
6
6
  this.type = this.getAttribute('type')
7
7
  this.live = JSON.parse(this.getAttribute('live'))
8
8
  this.danmaku = null
9
+ this.subs = []
9
10
 
10
11
  this.init()
11
12
  this.stream()
@@ -82,10 +83,12 @@ class Eplayer extends HTMLElement {
82
83
  this.video.play()
83
84
  this.danmaku.resume()
84
85
  this.$('.is-play').setAttribute('icon-id', 'pause')
86
+ this.emit('play')
85
87
  } else {
86
88
  this.video.pause()
87
89
  this.danmaku.pause()
88
90
  this.$('.is-play').setAttribute('icon-id', 'play')
91
+ this.emit('pause')
89
92
  }
90
93
  }
91
94
 
@@ -479,16 +482,6 @@ class Eplayer extends HTMLElement {
479
482
  let dom = this.shadowRoot.querySelectorAll(key)
480
483
  this.doms[key] = dom.length > 1 ? [...dom] : dom[0]
481
484
  }
482
-
483
-
484
- for (const name in Eplayer.plugins) {
485
- const cb = Eplayer.plugins[name]
486
- let node = document.createElement('li')
487
- node.innerText = name
488
- let panel = this.$('.panel')
489
- panel.appendChild(node)
490
- node.addEventListener('click', () => cb(this.shadowRoot))
491
- }
492
485
  }
493
486
 
494
487
  connectedCallback() {
@@ -524,7 +517,6 @@ class Eplayer extends HTMLElement {
524
517
  })
525
518
  this.delegate('keydown', this.keydown)
526
519
  this.delegate('mousemove', this.alow)
527
- this.$('.eplayer').oncontextmenu = () => false
528
520
  }
529
521
 
530
522
  delegate(type, map) {
@@ -546,14 +538,20 @@ class Eplayer extends HTMLElement {
546
538
  }
547
539
  }
548
540
 
541
+ emit (name) {
542
+ const fn = Eplayer.subs[name]
543
+ fn && fn.call(this, this.shadowRoot)
544
+ }
545
+
549
546
  }
550
547
 
551
- Eplayer.plugins = {}
548
+ Eplayer.subs = {}
552
549
 
553
550
  Eplayer.use = function (name, cb) {
554
- this.plugins[name] = cb
551
+ this.subs[name] = cb
555
552
  }
556
553
 
554
+
557
555
  function getTimeStr(time) {
558
556
  let h = Math.floor(time / 3600)
559
557
  let m = Math.floor((time % 3600) / 60)
@@ -574,8 +572,4 @@ function isFullScreen() {
574
572
  document.head.appendChild(link)
575
573
  })()
576
574
 
577
- Eplayer.use('github源码', (ep) => {
578
- window.location.href = 'https://github.com/132yse/eplayer'
579
- })
580
-
581
575
  customElements.define('e-player', Eplayer)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eplayer",
3
- "version": "1.6.5",
3
+ "version": "1.6.7",
4
4
  "description": "A web-components html5 video player facing future",
5
5
  "main": "./docs/eplayer.js",
6
6
  "module": "./docs/eplayer.js",