minor modification for preview

This commit is contained in:
DIYgod
2017-08-29 03:04:56 +08:00
parent f0357f199c
commit 47cb3f6615
5 changed files with 19 additions and 13 deletions
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+15 -9
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();
}