iframe.ts 382 B

12345678910111213141516171819
  1. const iframe = new iFrame();
  2. setInterval(function () {
  3. const video = document.querySelector("video") as HTMLVideoElement;
  4. if (video && video.currentTime && video.duration && video.paused) {
  5. iframe.send({
  6. error: false,
  7. currentTime: video.currentTime,
  8. duration: video.duration,
  9. paused: video.paused,
  10. });
  11. } else {
  12. iframe.send({
  13. error: true,
  14. });
  15. }
  16. }, 100);