Comparing version 1.3.2 to 1.3.3
@@ -5,2 +5,3 @@ class Eplayer extends HTMLElement { | ||
this.src = this.getAttribute('src') | ||
this.autoplay = this.getAttribute('autoplay') | ||
this.init() | ||
@@ -60,3 +61,2 @@ this.stream() | ||
} | ||
return false | ||
} | ||
@@ -74,3 +74,2 @@ | ||
} | ||
return false | ||
} | ||
@@ -95,3 +94,2 @@ | ||
this.video.currentTime = this.video.duration * offset | ||
return false | ||
} | ||
@@ -138,10 +136,12 @@ | ||
keyup(e) { | ||
keydown(e) { | ||
if (e && e.keyCode == 37) this.video.currentTime -= 10 | ||
if (e && e.keyCode == 39) this.video.currentTime += 10 | ||
if (e && e.keyCode == 38) this.video.volume += 0.05 | ||
if (e && e.keyCode == 40) this.video.volume -= 0.05 | ||
if (e && e.keyCode == 38) try{this.video.volume = parseInt(this.video.volume*100)/100 + 0.05}catch(e){} | ||
if (e && e.keyCode == 40) try{this.video.volume = parseInt(this.video.volume*100)/100 - 0.05}catch(e){} | ||
if (e && e.keyCode == 32) this.play() | ||
let index = Math.floor(this.video.volume * 10) | ||
setVolume(index, this.$('.line')) | ||
return false | ||
} | ||
@@ -195,2 +195,3 @@ | ||
font-size:12px; | ||
background:#000 | ||
} | ||
@@ -244,3 +245,4 @@ .eplayer{ | ||
padding:0 1px; | ||
margin-bottom: -2px | ||
margin-bottom: -2px; | ||
cursor:pointer | ||
} | ||
@@ -400,3 +402,2 @@ .line i{ | ||
dom() { | ||
window.onkeyup = e => this.keyup(e) | ||
this.video = this.$('video') | ||
@@ -419,2 +420,3 @@ this.video.volume = 0.5 | ||
this.$('.eplayer').onmousemove = () => this.alow() | ||
document.onkeydown = e => this.keydown(e) | ||
this.$('.ep-full').onclick = () => this.full() | ||
@@ -421,0 +423,0 @@ this.$('.ep-video').onclick = this.$('.is-play').onclick = () => this.play() |
{ | ||
"name": "eplayer", | ||
"version": "1.3.2", | ||
"version": "1.3.3", | ||
"description": "A web-components html5 video player facing future", | ||
"main": "./dist/eplayer.em.js", | ||
"main": "./docs/eplayer.em.js", | ||
"scripts": { | ||
@@ -7,0 +7,0 @@ "test": "echo \"Error: no test specified\" && exit 1", |
@@ -5,2 +5,3 @@ class Eplayer extends HTMLElement { | ||
this.src = this.getAttribute('src') | ||
this.autoplay = this.getAttribute('autoplay') | ||
this.init() | ||
@@ -60,3 +61,2 @@ this.stream() | ||
} | ||
return false | ||
} | ||
@@ -74,3 +74,2 @@ | ||
} | ||
return false | ||
} | ||
@@ -95,3 +94,2 @@ | ||
this.video.currentTime = this.video.duration * offset | ||
return false | ||
} | ||
@@ -138,10 +136,12 @@ | ||
keyup(e) { | ||
keydown(e) { | ||
if (e && e.keyCode == 37) this.video.currentTime -= 10 | ||
if (e && e.keyCode == 39) this.video.currentTime += 10 | ||
if (e && e.keyCode == 38) this.video.volume += 0.05 | ||
if (e && e.keyCode == 40) this.video.volume -= 0.05 | ||
if (e && e.keyCode == 38) try{this.video.volume = parseInt(this.video.volume*100)/100 + 0.05}catch(e){} | ||
if (e && e.keyCode == 40) try{this.video.volume = parseInt(this.video.volume*100)/100 - 0.05}catch(e){} | ||
if (e && e.keyCode == 32) this.play() | ||
let index = Math.floor(this.video.volume * 10) | ||
setVolume(index, this.$('.line')) | ||
return false | ||
} | ||
@@ -195,2 +195,3 @@ | ||
font-size:12px; | ||
background:#000 | ||
} | ||
@@ -244,3 +245,4 @@ .eplayer{ | ||
padding:0 1px; | ||
margin-bottom: -2px | ||
margin-bottom: -2px; | ||
cursor:pointer | ||
} | ||
@@ -400,3 +402,2 @@ .line i{ | ||
dom() { | ||
window.onkeyup = e => this.keyup(e) | ||
this.video = this.$('video') | ||
@@ -419,2 +420,3 @@ this.video.volume = 0.5 | ||
this.$('.eplayer').onmousemove = () => this.alow() | ||
document.onkeydown = e => this.keydown(e) | ||
this.$('.ep-full').onclick = () => this.full() | ||
@@ -421,0 +423,0 @@ this.$('.ep-video').onclick = this.$('.is-play').onclick = () => this.play() |
@@ -23,3 +23,3 @@ <p align="center"><img src="http://ww1.sinaimg.cn/large/0065Zy9egy1fvcjfzaa1lj30dw0dwwhe.jpg" alt="eplayer logo" width="200px"></p> | ||
<script src="https://unpkg.com/@webcomponents/webcomponentsjs@2.2.1/webcomponents-bundle.js"></script> | ||
<script src="./eplayer.b.js"></script> | ||
<script src="https://eplayer.js.org/eplayer.b.js"></script> | ||
``` | ||
@@ -50,5 +50,5 @@ | ||
#### hls & flv | ||
#### hls | ||
原生支持 `mp4` 和 `mkv` ,如果需要支持 `m3u8` 和 `flv`,需要先引入 `hls.js` | ||
原生支持 `mp4` 和 `mkv` ,如果需要支持 `m3u8`,需要先引入 `hls.js` | ||
@@ -63,14 +63,3 @@ 这两个文件太大,建议手动 gzip | ||
## Npm | ||
``` | ||
npm i eplayer --save | ||
``` | ||
注意,发布到 npm 的模块,只对外暴露了一个 Eplayer 类,需要自行 define customElements,并且是全局注册,只能注册一次 | ||
```Javascript | ||
impport Eplayer from 'eplayer' | ||
customElements.define('e-player',Eplayer) | ||
``` | ||
> 不推荐 npm install,请直接使用 cdn | ||
同样的,polyfill 和 hls.js 等仍然以 cdn 的方式加入 | ||
@@ -77,0 +66,0 @@ |
Sorry, the diff of this file is not supported yet
40812
11
1061
112