remove timeupdate event

This commit is contained in:
Harvey committed 2021-12-28 08:37:45 +08:00
1 parent ba4cbf1a80
commit 5d8b4fb7ce
7 files changed
+12 -45

No files matched your search

+1 -1
View File
@@ -111,7 +111,7 @@ export default function progress(option) {
setBar('loaded', player.loaded);
});
art.on('timeupdate', () => {
art.on('video:timeupdate', () => {
setBar('played', player.played);
});
-2
View File
@@ -2,7 +2,6 @@ import urlMix from './urlMix';
import attrInit from './attrInit';
import eventInit from './eventInit';
import exclusiveInit from './exclusiveInit';
import timeupdateInit from './timeupdateInit';
import playMix from './playMix';
import pauseMix from './pauseMix';
import toggleMix from './toggleMix';
@@ -35,7 +34,6 @@ export default class Player {
eventInit(art, this);
attrInit(art, this);
exclusiveInit(art, this);
timeupdateInit(art, this);
playMix(art, this);
pauseMix(art, this);
toggleMix(art, this);
+1 -1
View File
@@ -22,7 +22,7 @@ export default function loopMin(art, player) {
},
});
art.on('timeupdate', () => {
art.on('video:timeupdate', () => {
if (interval.length) {
if (player.currentTime < interval[0] || player.currentTime > interval[1]) {
player.seek = interval[0];
@@ -1,14 +0,0 @@
export default function timeupdateInit(art, player) {
let timer = null;
(function timeupdate() {
art.emit('timeupdate', player.currentTime || 0);
if (!art.isDestroy) {
timer = window.requestAnimationFrame(timeupdate);
}
})();
art.on('destroy', () => {
window.cancelAnimationFrame(timer);
});
}
@@ -25,7 +25,7 @@ export default function miniProgressBar(art) {
$progressBar.style.display = 'none';
});
art.on('timeupdate', () => {
art.on('video:timeupdate', () => {
$progressBar.style.width = `${player.played * 100}%`;
});
},