mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-28 02:01:20 -08:00
Create lock.js
This commit is contained in:
1 parent
0ed695a899
commit
f1310a3148
1 file changed
+33
@@ -0,0 +1,33 @@
|
|||||||
|
export default function lock(art) {
|
||||||
|
const { layers } = art;
|
||||||
|
|
||||||
|
layers.add({
|
||||||
|
name: 'miniProgressBar',
|
||||||
|
style: {
|
||||||
|
display: 'none',
|
||||||
|
position: 'absolute',
|
||||||
|
left: 0,
|
||||||
|
right: 0,
|
||||||
|
bottom: 0,
|
||||||
|
height: '2px',
|
||||||
|
backgroundColor: 'var(--theme)',
|
||||||
|
},
|
||||||
|
mounted($progressBar) {
|
||||||
|
art.on('control', (value) => {
|
||||||
|
$progressBar.style.display = value ? 'none' : 'block';
|
||||||
|
});
|
||||||
|
|
||||||
|
art.on('destroy', () => {
|
||||||
|
$progressBar.style.display = 'none';
|
||||||
|
});
|
||||||
|
|
||||||
|
art.on('video:timeupdate', () => {
|
||||||
|
$progressBar.style.width = `${art.played * 100}%`;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
return {
|
||||||
|
name: 'lock',
|
||||||
|
};
|
||||||
|
}
|
||||||
Reference in new issue
Block a user