<html><head></head><body>{"version":3,"file":"videoModule-DJxIDLge.js","sources":["../../src/scripts/modules/videoModule.ts"],"sourcesContent":["import { Component } from '@verndale/core';\r\nimport YouTubeIframeLoader from 'youtube-iframe';\r\nimport Player from '@vimeo/player';\r\n\r\ntype YouTubePlayer = {\r\n on: (event: string, callback: () => void) => void;\r\n playVideo: () => void;\r\n pauseVideo: () => void;\r\n mute: () => void;\r\n};\r\n\r\nclass VideoModule extends Component {\r\n videoId: string | undefined = undefined;\r\n provider: string | undefined = undefined;\r\n player: YouTubePlayer | Player | undefined;\r\n isPlaying: boolean;\r\n playLabel: string;\r\n pauseLabel: string;\r\n videoReady: boolean = false;\r\n\r\n constructor(el: HTMLElement) {\r\n super(el);\r\n if (this.el.dataset.textural && this.el.dataset.textural === 'true') this.isPlaying = true;\r\n else this.isPlaying = false;\r\n this.playLabel = this.el.dataset.playLabel || 'Play';\r\n this.pauseLabel = this.el.dataset.pauseLabel || 'Pause';\r\n if (this.dom.playButtonLabel)\r\n (this.dom.playButtonLabel as HTMLElement).textContent = this.isPlaying\r\n ? this.pauseLabel\r\n : this.playLabel;\r\n\r\n this.provider = (this.dom.el as HTMLElement).dataset.provider;\r\n this.videoId = (this.dom.el as HTMLElement).dataset.videoId;\r\n this.buildHtml();\r\n }\r\n\r\n setupDefaults() {\r\n this.dom = {\r\n el: this.el,\r\n videoPlaceholder: this.el.querySelector('.video-placeholder') as HTMLElement,\r\n backgroundImage: this.el.querySelector('.picture') as HTMLImageElement,\r\n playButton: this.el.querySelector('.play-button') as HTMLElement,\r\n playButtonLabel: this.el.querySelector('.play-button-label') as HTMLElement,\r\n playIcon: this.el.querySelector('.play-icon') as HTMLElement,\r\n pauseIcon: this.el.querySelector('.pause-icon') as HTMLElement,\r\n localVideo: this.el.querySelector('video') as HTMLVideoElement\r\n };\r\n }\r\n\r\n addListeners() {\r\n (this.dom.playButton as HTMLButtonElement)?.addEventListener(\r\n 'click',\r\n this.handlePlayButtonClick.bind(this)\r\n );\r\n\r\n if (this.dom.localVideo && (this.dom.localVideo as HTMLVideoElement).readyState === 4) {\r\n (this.el as HTMLElement).classList.add('loaded');\r\n (this.dom.playButton as HTMLElement).removeAttribute('disabled');\r\n this.videoReady = true;\r\n }\r\n //add load listener to localVideo\r\n if (this.dom.localVideo && (this.dom.localVideo as HTMLVideoElement).readyState < 3)\r\n (this.dom.localVideo as HTMLVideoElement).addEventListener('loadeddata', () => {\r\n (this.el as HTMLElement).classList.add('loaded');\r\n (this.dom.playButton as HTMLElement).removeAttribute('disabled');\r\n this.videoReady = true;\r\n });\r\n }\r\n\r\n checkIconsAndLabelsState() {\r\n if (this.dom.playButtonLabel as HTMLElement)\r\n (this.dom.playButtonLabel as HTMLElement).innerHTML = this.isPlaying\r\n ? this.pauseLabel\r\n : this.playLabel;\r\n\r\n if (this.dom.playIcon && this.dom.pauseIcon) {\r\n if (this.isPlaying) {\r\n (this.dom.playIcon as HTMLElement).style.display = 'none';\r\n (this.dom.pauseIcon as HTMLElement).style.display = 'block';\r\n } else {\r\n (this.dom.playIcon as HTMLElement).style.display = 'block';\r\n (this.dom.pauseIcon as HTMLElement).style.display = 'none';\r\n }\r\n }\r\n }\r\n\r\n buildHtml() {\r\n if (this.provider === 'vimeo') {\r\n this.initVimeoVideo();\r\n } else if (this.provider === 'youtube') {\r\n this.initYoutubeVideo();\r\n }\r\n if (this.dom.localVideo) {\r\n this.initLocalVideo();\r\n }\r\n this.checkIconsAndLabelsState();\r\n }\r\n\r\n initLocalVideo() {\r\n (this.el as HTMLElement).classList.add('loaded');\r\n if (this.dom.playButton) {\r\n (this.dom.playButton as HTMLElement).removeAttribute('disabled');\r\n }\r\n this.videoReady = true;\r\n if (this.el.dataset.textural && this.el.dataset.textural === 'true') {\r\n (this.dom.videoPlaceholder as HTMLElement).style.display = 'block';\r\n }\r\n }\r\n\r\n initYoutubeVideo() {\r\n YouTubeIframeLoader.load(YT => {\r\n this.player = new YT.Player(this.dom.videoPlaceholder, {\r\n height: '100%',\r\n width: '100%',\r\n host: 'https://www.youtube-nocookie.com',\r\n videoId: this.videoId,\r\n origin: window.location.origin,\r\n playerVars: {\r\n controls: 1,\r\n rel: 0\r\n },\r\n events: {\r\n onReady: () => {\r\n (this.dom.playButton as HTMLElement).removeAttribute('disabled');\r\n (this.dom.el as HTMLElement).classList.add('loaded');\r\n this.videoReady = true;\r\n },\r\n onStateChange: (event: { data: unknown }) => {\r\n if (event.data === YT.PlayerState.ENDED) {\r\n this.isPlaying = false;\r\n this.checkIconsAndLabelsState();\r\n }\r\n }\r\n }\r\n });\r\n });\r\n }\r\n\r\n initVimeoVideo() {\r\n const options = {\r\n id: parseInt(this.videoId as string)\r\n };\r\n\r\n const player = new Player(this.dom.videoPlaceholder as HTMLElement, options);\r\n player.on('loaded', () => {\r\n (this.dom.playButton as HTMLElement).removeAttribute('disabled');\r\n (this.dom.el as HTMLElement).classList.add('loaded');\r\n this.videoReady = true;\r\n });\r\n this.player = player;\r\n }\r\n\r\n handlePlayButtonClick() {\r\n if (!this.videoReady) return;\r\n if (this.dom.backgroundImage)\r\n (this.dom.backgroundImage as HTMLImageElement).style.display = 'none';\r\n if (this.isPlaying) {\r\n if (this.provider === 'vimeo') {\r\n (this.player as Player).pause();\r\n } else if (this.provider === 'youtube') {\r\n (this.player as YouTubePlayer).pauseVideo();\r\n } else if (this.dom.localVideo) {\r\n (this.dom.localVideo as HTMLVideoElement).pause();\r\n }\r\n this.isPlaying = false;\r\n } else if (!this.isPlaying) {\r\n if (this.provider === 'vimeo') {\r\n (this.player as Player).play();\r\n (this.dom.videoPlaceholder as HTMLElement).style.display = 'block';\r\n } else if (this.provider === 'youtube') {\r\n (this.player as YouTubePlayer).playVideo();\r\n (this.dom.videoPlaceholder as HTMLElement).style.display = 'block';\r\n if (this.el.querySelector('.video-placeholder'))\r\n (this.el.querySelector('.video-placeholder') as HTMLElement).style.display = 'block';\r\n } else if (this.dom.localVideo) {\r\n (this.dom.localVideo as HTMLVideoElement).play();\r\n (this.dom.videoPlaceholder as HTMLElement).style.display = 'block';\r\n }\r\n this.isPlaying = true;\r\n }\r\n if (this.dom.playButton) {\r\n if (this.el.dataset.textural && this.el.dataset.textural === 'true') {\r\n if (!this.isPlaying) {\r\n (this.dom.playIcon as HTMLElement).style.display = 'none';\r\n (this.dom.pauseIcon as HTMLElement).style.display = 'block';\r\n } else {\r\n (this.dom.playIcon as HTMLElement).style.display = 'block';\r\n (this.dom.pauseIcon as HTMLElement).style.display = 'none';\r\n }\r\n } else {\r\n (this.dom.playButton as HTMLElement).style.display = 'none';\r\n }\r\n }\r\n\r\n this.checkIconsAndLabelsState();\r\n }\r\n}\r\n\r\nexport default VideoModule;\r\n"],"names":["VideoModule","Component","el","__publicField","_a","YouTubeIframeLoader","YT","event","options","player","Player"],"mappings":"oQAWA,MAAMA,UAAoBC,CAAU,CASlC,YAAYC,EAAiB,CAC3B,MAAMA,CAAE,EATVC,EAAA,gBACAA,EAAA,iBACAA,EAAA,eACAA,EAAA,kBACAA,EAAA,kBACAA,EAAA,mBACAA,EAAA,kBAAsB,IAIhB,KAAK,GAAG,QAAQ,UAAY,KAAK,GAAG,QAAQ,WAAa,OAAQ,KAAK,UAAY,GACjF,KAAK,UAAY,GACtB,KAAK,UAAY,KAAK,GAAG,QAAQ,WAAa,OAC9C,KAAK,WAAa,KAAK,GAAG,QAAQ,YAAc,QAC5C,KAAK,IAAI,kBACV,KAAK,IAAI,gBAAgC,YAAc,KAAK,UACzD,KAAK,WACL,KAAK,WAEX,KAAK,SAAY,KAAK,IAAI,GAAmB,QAAQ,SACrD,KAAK,QAAW,KAAK,IAAI,GAAmB,QAAQ,QACpD,KAAK,UAAU,CAAA,CAGjB,eAAgB,CACd,KAAK,IAAM,CACT,GAAI,KAAK,GACT,iBAAkB,KAAK,GAAG,cAAc,oBAAoB,EAC5D,gBAAiB,KAAK,GAAG,cAAc,UAAU,EACjD,WAAY,KAAK,GAAG,cAAc,cAAc,EAChD,gBAAiB,KAAK,GAAG,cAAc,oBAAo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AU,QACvD,KAAK,GAAG,cAAc,oBAAoB,IAC3C,KAAK,GAAG,cAAc,oBAAoB,EAAkB,MAAM,QAAU,UACtE,KAAK,IAAI,aACjB,KAAK,IAAI,WAAgC,KAAK,EAC9C,KAAK,IAAI,iBAAiC,MAAM,QAAU,SAE7D,KAAK,UAAY,IAEf,KAAK,IAAI,aACP,KAAK,GAAG,QAAQ,UAAY,KAAK,GAAG,QAAQ,WAAa,OACtD,KAAK,WAIP,KAAK,IAAI,SAAyB,MAAM,QAAU,QAClD,KAAK,IAAI,UAA0B,MAAM,QAAU,SAJnD,KAAK,IAAI,SAAyB,MAAM,QAAU,OAClD,KAAK,IAAI,UAA0B,MAAM,QAAU,SAMrD,KAAK,IAAI,WAA2B,MAAM,QAAU,QAIzD,KAAK,yBAAyB,EAAA,CAElC"}<style> .hidden { display: none; } </style> <a href="http://web-sitemap.arogike.net" class="hidden">BoBo娱乐</a> <a href="http://ttmafh.qdruntan.com" class="hidden">好彩网</a> <a href="http://www.babyfeedingshop.com" class="hidden">European-Cup-buying-entrance-hr@babyfeedingshop.com</a> <a href="http://nxozze.svztur.com" class="hidden">潍坊地图交通图</a> <a href="http://www.bigtrecords.com" class="hidden">欧洲杯竞猜</a> <a href="http://www.zlmmc8.com" class="hidden">皇冠体育app</a> <a href="http://www.cesametal.net" class="hidden">亚洲体育博彩平台</a> <a href="http://www.rf518.com" class="hidden">Sports-betting-platform-service@rf518.com</a> <a href="http://www.smxjjl.com" class="hidden">Sabah-sports-betting-sales@smxjjl.com</a> <a href="http://www.iconfuture.net" class="hidden">Sun-City-official-website-service@iconfuture.net</a> <a href="http://www.izuanhui.net" class="hidden">买球平台</a> <a href="http://www.noujcf.com" class="hidden">Crown-betting-media@noujcf.com</a> <a href="http://www.xingtaiyichuang.com" class="hidden">Football-buying-service@xingtaiyichuang.com</a> <a href="http://irrmfl.daily-double.com" class="hidden">IT168数字家电频道</a> <a href="http://nrnheu.ciecc-oc.com" class="hidden">惠人原汁机中国官方网站</a> <a href="http://sevvsj.315tccs.com" class="hidden">黑客流安全网</a> <a href="http://www.khobuon.net" class="hidden">Sun-City-media@khobuon.net</a> <a href="http://averytoolschoice.net" class="hidden">玄殿社区</a> <a href="http://adhtes.hjgonline.com" class="hidden">云铜科技</a> <a href="http://www.mygril-yaoyao.com" class="hidden">Gaming-platform-billing@mygril-yaoyao.com</a> <a href="https://tw.dictionary.yahoo.com/dictionary?p=✔️最新网址:la55.net✔️科普一下中国购彩信誉平台的百科.zir" class="hidden">58同城大连分类信息网</a> <a href="https://stock.adobe.com/search?k=✔️网址:la666.net✔️hg皇冠官网登录平台介绍" class="hidden">大公网佛教频道</a> <a href="https://es-la.facebook.com/public/✔️网址:la666.net✔️新濠天地.平台-新濠天地.平台官方网站.zqi" class="hidden">华东政法大学招生网</a> <a href="https://es-la.facebook.com/public/正规电子游戏app✔️网址:la66.net✔️.rzf" class="hidden">中国兵器装备集团公司</a> <a href="https://es-la.facebook.com/public/宝盈集团bbin平台介绍✔️最新网址:la55.net✔️宝盈集团bbin平台介绍✔️最新网址:la55.net✔️.yau" class="hidden">佳木斯文学网</a> <a href="https://es-la.facebook.com/public/✔️最新网址:ad22.net✔️(关于皇冠体育官方网站下载的简介)皇冠体育官方网站下载" class="hidden">搜鹿网</a> <a href="https://www.deep6gear.com/catalogsearch/result/?q=优德88手机客户端下载-优德88手机客户端下载官方网站✔️网址:la666.net✔️.nrn" class="hidden">杉杉控股</a> <a href="https://tw.dictionary.yahoo.com/dictionary?p=科普一下亚洲bet365的百科✔️官方网址:la777.net✔️" class="hidden">拼车网</a> <a href="https://acrmc.com/search/✔️最新网址:ad22.net✔️科普一下立即博手机客户端的百科.nlf" class="hidden">联合国儿童基金会</a> <a href="https://stock.adobe.com/search/images?k=在线赌博推荐赌博网站大全(中国)有限公司✔️网址:la666.net✔️.uqu" class="hidden">深圳人才网</a> <a href="/CN/udebge-369518.html" class="hidden">9199无忧传奇 </a> <a href="/sttcs/hot-news/changar.html" class="hidden">中易腾达</a> <a href="/news/ybzsuw-480989" class="hidden">中华农历网</a> <a href="/sitemap.xml" class="hidden">站点地图</a> </body></html>