Files
ArtPlayer/packages/artplayer/src/plugins/miniProgressBar.js
T
2022-04-27 21:46:37 +08:00

27 lines
746 B
JavaScript

export default function miniProgressBar(art) {
art.on('ready', () => {
art.layers.add({
name: 'miniProgressBar',
mounted($progressBar) {
art.on('destroy', () => {
$progressBar.style.display = 'none';
});
art.on('video:timeupdate', () => {
$progressBar.style.width = `${art.played * 100}%`;
});
art.on('setBar', (type, percentage) => {
if (type === 'played') {
$progressBar.style.width = `${percentage * 100}%`;
}
});
},
});
});
return {
name: 'miniProgressBar',
};
}