{"version":3,"file":"playpause.component.bundle.js","sources":["../../../../Frontend/js/components/playpause.component.ts"],"sourcesContent":["export const playPause = (): void => {\r\n const playPauseButton = document.getElementById(\"playPauseButton\") as HTMLElement\r\n const video = document.getElementById(\"backgroundVideo\") as HTMLIFrameElement\r\n\r\n playPauseButton?.addEventListener(\"click\", (e) => onClick(e, video))\r\n}\r\n\r\nconst onClick = (e: Event, video: HTMLIFrameElement): void => {\r\n const playPauseButton = e.target as HTMLElement\r\n if (video && video.contentWindow) {\r\n const src = new URL(video.src)\r\n\r\n const hostname = src.hostname\r\n\r\n if (playPauseButton?.classList.contains(\"pause\")) {\r\n playPauseButton.classList.remove(\"pause\")\r\n playPauseButton.classList.add(\"play\")\r\n\r\n if (hostname.includes(\"youtube\")) {\r\n video.contentWindow.postMessage('{\"event\":\"command\",\"func\":\"pauseVideo\",\"args\":\"\"}', \"*\")\r\n } else if (hostname.includes(\"vimeo.com\")) {\r\n video.contentWindow.postMessage('{\"method\":\"pause\"}', \"*\")\r\n }\r\n } else {\r\n playPauseButton.classList.remove(\"play\")\r\n playPauseButton.classList.add(\"pause\")\r\n\r\n if (hostname.includes(\"youtube\")) {\r\n video.contentWindow.postMessage('{\"event\":\"command\",\"func\":\"playVideo\",\"args\":\"\"}', \"*\")\r\n } else if (hostname.includes(\"vimeo.com\")) {\r\n video.contentWindow.postMessage('{\"method\":\"play\"}', \"*\")\r\n }\r\n }\r\n }\r\n}\r\n"],"names":["playPause","playPauseButton","video","e","onClick","hostname"],"mappings":"AAAO,MAAMA,EAAY,IAAY,CAC7B,MAAAC,EAAkB,SAAS,eAAe,iBAAiB,EAC3DC,EAAQ,SAAS,eAAe,iBAAiB,EAEvDD,GAAiB,iBAAiB,QAAUE,GAAMC,EAAQD,EAAGD,CAAK,CAAC,CACrE,EAEME,EAAU,CAACD,EAAUD,IAAmC,CAC5D,MAAMD,EAAkBE,EAAE,OACtB,GAAAD,GAASA,EAAM,cAAe,CAGhC,MAAMG,EAFM,IAAI,IAAIH,EAAM,GAAG,EAER,SAEjBD,GAAiB,UAAU,SAAS,OAAO,GAC7BA,EAAA,UAAU,OAAO,OAAO,EACxBA,EAAA,UAAU,IAAI,MAAM,EAEhCI,EAAS,SAAS,SAAS,EACvBH,EAAA,cAAc,YAAY,oDAAqD,GAAG,EAC/EG,EAAS,SAAS,WAAW,GAChCH,EAAA,cAAc,YAAY,qBAAsB,GAAG,IAG3CD,EAAA,UAAU,OAAO,MAAM,EACvBA,EAAA,UAAU,IAAI,OAAO,EAEjCI,EAAS,SAAS,SAAS,EACvBH,EAAA,cAAc,YAAY,mDAAoD,GAAG,EAC9EG,EAAS,SAAS,WAAW,GAChCH,EAAA,cAAc,YAAY,oBAAqB,GAAG,EAE5D,CAEJ"}