minor modification for preview

This commit is contained in:
DIYgod 2017-08-29 03:04:56 +08:00
parent f0357f199c
commit 47cb3f6615
No known key found for this signature in database
GPG Key ID: EC0B76A252D3EF67
5 changed files with 19 additions and 13 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

2
dist/DPlayer.min.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1114,7 +1114,7 @@ class DPlayer {
case 'mousemove':
this.isMouseHoverPbar = true;
this.setPreviewSourceAndFrame({
url: this.video.current.src,
url: this.video.src,
time
});
this.timeTipsDisplay(true, timeTips);
@ -1151,16 +1151,22 @@ class DPlayer {
this.previewCanvas = this.element.getElementsByClassName('dplayer-bar-preview-canvas')[0];
this.previewVideo.preload = 'auto';
const w = this.element.offsetWidth / 3;
const h = this.element.offsetHeight / 3;
this.previewWrapper.style.width = `${w}px`;
this.previewWrapper.style.height = `${h}px`;
this.previewWrapper.style.top = `${-h}px`;
this.previewCanvas.width = w;
this.previewCanvas.height = h;
const resize = () => {
const w = this.element.offsetWidth / 4;
const h = this.element.offsetHeight / 4;
this.previewWrapper.style.width = `${w}px`;
this.previewWrapper.style.height = `${h}px`;
this.previewWrapper.style.top = `${-h + 2}px`;
this.previewCanvas.width = w;
this.previewCanvas.height = h;
};
resize();
this.video.addEventListener('loadedmetadata', () => {
resize();
});
this.setPreviewSourceAndFrame({
url: this.video.current.src, time: 0
url: this.video.src, time: 0
});
this.bindPreviewEvent();
}