optimize seek marked words; change version link; fix loading checker
This commit is contained in:
parent
1ff8e0e2f2
commit
652c6dc06c
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -177,13 +177,13 @@ class DPlayer {
|
|||
// whether the video is buffering
|
||||
currentPlayPos = this.video.currentTime;
|
||||
if (!bufferingDetected
|
||||
&& currentPlayPos < lastPlayPos + 0.01
|
||||
&& currentPlayPos === lastPlayPos
|
||||
&& !this.video.paused) {
|
||||
this.element.classList.add('dplayer-loading');
|
||||
bufferingDetected = true;
|
||||
}
|
||||
if (bufferingDetected
|
||||
&& currentPlayPos > lastPlayPos + 0.01
|
||||
&& currentPlayPos > lastPlayPos
|
||||
&& !this.video.paused) {
|
||||
this.element.classList.remove('dplayer-loading');
|
||||
bufferingDetected = false;
|
||||
|
|
@ -231,16 +231,6 @@ class DPlayer {
|
|||
}
|
||||
};
|
||||
|
||||
pbar.addEventListener('click', (event) => {
|
||||
const e = event || window.event;
|
||||
barWidth = pbar.clientWidth;
|
||||
let percentage = (e.clientX - utils.getElementViewLeft(pbar)) / barWidth;
|
||||
percentage = percentage > 0 ? percentage : 0;
|
||||
percentage = percentage < 1 ? percentage : 1;
|
||||
this.updateBar('played', percentage, 'width');
|
||||
this.seek(parseFloat(bar.playedBar.style.width) / 100 * this.video.duration);
|
||||
});
|
||||
|
||||
if (this.option.video.thumbnails) {
|
||||
this.initThumbnails();
|
||||
}
|
||||
|
|
@ -251,8 +241,7 @@ class DPlayer {
|
|||
pbar.addEventListener('mouseleave', this.mouseHandler);
|
||||
|
||||
|
||||
const thumbMove = (event) => {
|
||||
const e = event || window.event;
|
||||
const thumbMove = (e) => {
|
||||
let percentage = (e.clientX - utils.getElementViewLeft(pbar)) / barWidth;
|
||||
percentage = percentage > 0 ? percentage : 0;
|
||||
percentage = percentage < 1 ? percentage : 1;
|
||||
|
|
@ -260,9 +249,13 @@ class DPlayer {
|
|||
this.element.getElementsByClassName('dplayer-ptime')[0].innerHTML = utils.secondToTime(percentage * this.video.duration);
|
||||
};
|
||||
|
||||
const thumbUp = () => {
|
||||
const thumbUp = (e) => {
|
||||
document.removeEventListener('mouseup', thumbUp);
|
||||
document.removeEventListener('mousemove', thumbMove);
|
||||
let percentage = (e.clientX - utils.getElementViewLeft(pbar)) / barWidth;
|
||||
percentage = percentage > 0 ? percentage : 0;
|
||||
percentage = percentage < 1 ? percentage : 1;
|
||||
this.updateBar('played', percentage, 'width');
|
||||
this.seek(parseFloat(bar.playedBar.style.width) / 100 * this.video.duration);
|
||||
this.setTime();
|
||||
};
|
||||
|
|
@ -779,12 +772,12 @@ class DPlayer {
|
|||
if (this.video.duration) {
|
||||
time = Math.min(time, this.video.duration);
|
||||
}
|
||||
|
||||
console.log(time, this.video.currentTime, time - this.video.currentTime);
|
||||
if (this.video.currentTime < time) {
|
||||
this.notice(`${this.tran('FF to')} ${utils.secondToTime(time)}`);
|
||||
this.notice(`${this.tran('FF')} ${(time - this.video.currentTime).toFixed(0)} ${this.tran('s')}`);
|
||||
}
|
||||
else if (this.video.currentTime > time) {
|
||||
this.notice(`${this.tran('REW to')} ${utils.secondToTime(time)}`);
|
||||
this.notice(`${this.tran('REW')} ${(this.video.currentTime - time).toFixed(0)} ${this.tran('s')}`);
|
||||
}
|
||||
|
||||
this.video.currentTime = time;
|
||||
|
|
|
|||
11
src/i18n.js
11
src/i18n.js
|
|
@ -42,15 +42,16 @@ const tranTxt = {
|
|||
'Switching to': '正在切换至',
|
||||
'Switched to': '已经切换至',
|
||||
'quality': '画质',
|
||||
'FF to': '快进至',
|
||||
'REW to': '快退至',
|
||||
'FF': '快进',
|
||||
'REW': '快退',
|
||||
'Unlimited danmaku': '海量弹幕',
|
||||
'Send danmaku': '发送弹幕',
|
||||
'Setting': '设置',
|
||||
'Full screen': '全屏',
|
||||
'Web full screen': '页面全屏',
|
||||
'Send': '发送',
|
||||
'Screenshot': '截图'
|
||||
'Screenshot': '截图',
|
||||
's': '秒'
|
||||
},
|
||||
"zh-tw" : {
|
||||
'Danmaku is loading': '彈幕加載中',
|
||||
|
|
@ -73,8 +74,8 @@ const tranTxt = {
|
|||
'Switching to': '正在切換至',
|
||||
'Switched to': '已經切換至',
|
||||
'quality': '畫質',
|
||||
'FF to': '快進至',
|
||||
'REW to': '快退至',
|
||||
'FF': '快進',
|
||||
'REW': '快退',
|
||||
'Unlimited danmaku': '海量彈幕'
|
||||
}
|
||||
};
|
||||
|
|
@ -54,7 +54,7 @@ module.exports = (option) => {
|
|||
link: 'https://github.com/DIYgod/DPlayer/issues'
|
||||
}, {
|
||||
text: `DPlayer ${DPLAYER_VERSION} ${GIT_HASH}`,
|
||||
link: 'https://github.com/MoePlayer/DPlayer/commits/master'
|
||||
link: 'https://github.com/MoePlayer/DPlayer/releases'
|
||||
}]);
|
||||
|
||||
return option;
|
||||
|
|
|
|||
Loading…
Reference in New Issue