iframe.ts 681 B

1234567891011121314151617181920212223242526272829
  1. // Note: Alternate hosts (openload, streammango) are currently disabled on the site (can't switch to them),
  2. // if this changes or they switch their main host, this will need to be updated.
  3. const iframe = new iFrame()
  4. let sendback: {
  5. currentTime: number
  6. duration: number
  7. paused: boolean
  8. }
  9. function send(): void {
  10. iframe.send(sendback)
  11. }
  12. iframe.on('UpdateData', () => {
  13. if (document.querySelector('#kwikPlayer')) {
  14. const video = document.querySelector<HTMLVideoElement>('#kwikPlayer')
  15. if (video) {
  16. sendback = {
  17. currentTime: video.currentTime,
  18. duration: video.duration,
  19. paused: video.paused,
  20. }
  21. send()
  22. }
  23. }
  24. })