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