mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-11 18:41:47 +00:00
15 lines
549 B
TypeScript
15 lines
549 B
TypeScript
export default () => {
|
|
document.addEventListener('apiLoaded', (apiEvent) => {
|
|
apiEvent.detail.addEventListener('videodatachange', (name: string) => {
|
|
if (name === 'dataloaded') {
|
|
apiEvent.detail.pauseVideo();
|
|
(document.querySelector('video') as HTMLVideoElement)?.addEventListener('timeupdate', (e) => {
|
|
(e.target as HTMLVideoElement)?.pause();
|
|
});
|
|
} else {
|
|
(document.querySelector('video') as HTMLVideoElement).ontimeupdate = null;
|
|
}
|
|
});
|
|
}, { once: true, passive: true });
|
|
};
|