iframe.ts 479 B

1234567891011121314151617
  1. const iframe = new iFrame()
  2. iframe.on('UpdateData', async () => {
  3. const paths: string[] = document.location.pathname.split('/')
  4. if (!paths[0])
  5. paths.shift()
  6. if (paths[0] !== 'anime' && paths[1] && paths[2])
  7. return
  8. const video = document.querySelector<HTMLVideoElement>('#html5player')
  9. if (video && !Number.isNaN(video.duration)) {
  10. iframe.send({
  11. duration: video.duration,
  12. currentTime: video.currentTime,
  13. paused: video.paused,
  14. })
  15. }
  16. })