iframe.ts 508 B

12345678910111213141516171819
  1. const iframe = new iFrame()
  2. iframe.on('UpdateData', async () => {
  3. let video: HTMLVideoElement | null = null
  4. if (document.querySelector('.jw-video'))
  5. video = document.querySelector('.jw-video')
  6. else if (document.querySelector('.html5-video-container'))
  7. video = document.querySelector('.html5-video-container > video')
  8. if (video && !Number.isNaN(video.duration)) {
  9. iframe.send({
  10. current: video.currentTime,
  11. duration: video.duration,
  12. paused: video.paused,
  13. })
  14. }
  15. })