mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-16 12:42:06 +00:00
Reset segments on song end
This commit is contained in:
@ -10,7 +10,9 @@ module.exports = () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
document.addEventListener('apiLoaded', () => {
|
document.addEventListener('apiLoaded', () => {
|
||||||
document.querySelector('video').addEventListener('timeupdate', e => {
|
const video = document.querySelector('video');
|
||||||
|
|
||||||
|
video.addEventListener('timeupdate', e => {
|
||||||
currentSegments.forEach((segment) => {
|
currentSegments.forEach((segment) => {
|
||||||
if (
|
if (
|
||||||
e.target.currentTime >= segment[0] &&
|
e.target.currentTime >= segment[0] &&
|
||||||
@ -23,5 +25,7 @@ module.exports = () => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
// Reset segments on song end
|
||||||
|
video.addEventListener('emptied', () => currentSegments = []);
|
||||||
}, { once: true, passive: true })
|
}, { once: true, passive: true })
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user