fix miniProgressBar bug

This commit is contained in:
zhw2590582 committed 2019-05-03 21:43:15 +08:00
1 parent d0fd5abcd3
commit 6824543951
3 files changed
+9 -47

No files matched your search

@@ -5,8 +5,6 @@ export default function miniProgressBar(art) {
option: { theme },
} = art;
let timer = null;
layers.add({
name: 'miniProgressBar',
style: {
@@ -19,30 +17,14 @@ export default function miniProgressBar(art) {
background: theme,
},
mounted($progressBar) {
function hide() {
if (timer) {
clearTimeout(timer);
}
$progressBar.style.display = 'none';
}
function show() {
if (player.playing) {
timer = setTimeout(() => {
$progressBar.style.display = 'block';
}, 200);
}
}
art.on('controls:show', () => {
hide();
$progressBar.style.display = 'none';
});
art.on('hoverenter', () => {
hide();
});
art.on('hoverleave', () => {
show();
art.on('controls:hide', () => {
$progressBar.style.display = 'block';
});
art.on('video:timeupdate', () => {
$progressBar.style.width = `${player.played * 100}%`;
});