{"version":3,"file":"jarallax-video.js","sources":["../node_modules/video-worker/dist/video-worker.esm.js","../src/utils/ready.js","../src/utils/global.js","../src/ext-video.js","../src/ext-video.umd.js"],"sourcesContent":["/*!\n * Name : Video Worker\n * Version : 2.0.0\n * Author : nK \n * GitHub : https://github.com/nk-o/video-worker\n */\n\n/* eslint-disable import/no-mutable-exports */\n\n/* eslint-disable no-restricted-globals */\nlet win;\n\nif (typeof window !== 'undefined') {\n win = window;\n} else if (typeof global !== 'undefined') {\n win = global;\n} else if (typeof self !== 'undefined') {\n win = self;\n} else {\n win = {};\n}\n\nvar global$1 = win;\n\n// Deferred\n// thanks http://stackoverflow.com/questions/18096715/implement-deferred-object-without-using-jquery\nfunction Deferred() {\n this.doneCallbacks = [];\n this.failCallbacks = [];\n}\n\nDeferred.prototype = {\n execute(list, args) {\n let i = list.length; // eslint-disable-next-line no-param-reassign\n\n args = Array.prototype.slice.call(args);\n\n while (i) {\n i -= 1;\n list[i].apply(null, args);\n }\n },\n\n resolve(...args) {\n this.execute(this.doneCallbacks, args);\n },\n\n reject(...args) {\n this.execute(this.failCallbacks, args);\n },\n\n done(callback) {\n this.doneCallbacks.push(callback);\n },\n\n fail(callback) {\n this.failCallbacks.push(callback);\n }\n\n};\n\nlet ID = 0;\nlet YoutubeAPIadded = 0;\nlet VimeoAPIadded = 0;\nlet loadingYoutubePlayer = 0;\nlet loadingVimeoPlayer = 0;\nconst loadingYoutubeDefer = /*#__PURE__*/new Deferred();\nconst loadingVimeoDefer = /*#__PURE__*/new Deferred();\n\nclass VideoWorker {\n constructor(url, options) {\n const self = this;\n self.url = url;\n self.options_default = {\n autoplay: false,\n loop: false,\n mute: false,\n volume: 100,\n showControls: true,\n accessibilityHidden: false,\n // start / end video time in seconds\n startTime: 0,\n endTime: 0\n };\n self.options = self.extend({}, self.options_default, options); // Fix wrong option name.\n // Thanks to https://github.com/nk-o/video-worker/issues/13.\n\n if (typeof self.options.showContols !== 'undefined') {\n self.options.showControls = self.options.showContols;\n delete self.options.showContols;\n } // check URL\n\n\n self.videoID = self.parseURL(url); // init\n\n if (self.videoID) {\n self.ID = ID;\n ID += 1;\n self.loadAPI();\n self.init();\n }\n } // Extend like jQuery.extend\n // eslint-disable-next-line class-methods-use-this\n\n\n extend(...args) {\n const out = args[0] || {};\n Object.keys(args).forEach(i => {\n if (!args[i]) {\n return;\n }\n\n Object.keys(args[i]).forEach(key => {\n out[key] = args[i][key];\n });\n });\n return out;\n }\n\n parseURL(url) {\n // parse youtube ID\n function getYoutubeID(ytUrl) {\n // eslint-disable-next-line no-useless-escape\n const regExp = /.*(?:youtu.be\\/|v\\/|u\\/\\w\\/|embed\\/|watch\\?v=)([^#\\&\\?]*).*/;\n const match = ytUrl.match(regExp);\n return match && match[1].length === 11 ? match[1] : false;\n } // parse vimeo ID\n\n\n function getVimeoID(vmUrl) {\n // eslint-disable-next-line no-useless-escape\n const regExp = /https?:\\/\\/(?:www\\.|player\\.)?vimeo.com\\/(?:channels\\/(?:\\w+\\/)?|groups\\/([^/]*)\\/videos\\/|album\\/(\\d+)\\/video\\/|video\\/|)(\\d+)(?:$|\\/|\\?)/;\n const match = vmUrl.match(regExp);\n return match && match[3] ? match[3] : false;\n } // parse local string\n\n\n function getLocalVideos(locUrl) {\n // eslint-disable-next-line no-useless-escape\n const videoFormats = locUrl.split(/,(?=mp4\\:|webm\\:|ogv\\:|ogg\\:)/);\n const result = {};\n let ready = 0;\n videoFormats.forEach(val => {\n // eslint-disable-next-line no-useless-escape\n const match = val.match(/^(mp4|webm|ogv|ogg)\\:(.*)/);\n\n if (match && match[1] && match[2]) {\n // eslint-disable-next-line prefer-destructuring\n result[match[1] === 'ogv' ? 'ogg' : match[1]] = match[2];\n ready = 1;\n }\n });\n return ready ? result : false;\n }\n\n const Youtube = getYoutubeID(url);\n const Vimeo = getVimeoID(url);\n const Local = getLocalVideos(url);\n\n if (Youtube) {\n this.type = 'youtube';\n return Youtube;\n }\n\n if (Vimeo) {\n this.type = 'vimeo';\n return Vimeo;\n }\n\n if (Local) {\n this.type = 'local';\n return Local;\n }\n\n return false;\n }\n\n isValid() {\n return !!this.videoID;\n } // events\n\n\n on(name, callback) {\n this.userEventsList = this.userEventsList || []; // add new callback in events list\n\n (this.userEventsList[name] || (this.userEventsList[name] = [])).push(callback);\n }\n\n off(name, callback) {\n if (!this.userEventsList || !this.userEventsList[name]) {\n return;\n }\n\n if (!callback) {\n delete this.userEventsList[name];\n } else {\n this.userEventsList[name].forEach((val, key) => {\n if (val === callback) {\n this.userEventsList[name][key] = false;\n }\n });\n }\n }\n\n fire(name, ...args) {\n if (this.userEventsList && typeof this.userEventsList[name] !== 'undefined') {\n this.userEventsList[name].forEach(val => {\n // call with all arguments\n if (val) {\n val.apply(this, args);\n }\n });\n }\n }\n\n play(start) {\n const self = this;\n\n if (!self.player) {\n return;\n }\n\n if (self.type === 'youtube' && self.player.playVideo) {\n if (typeof start !== 'undefined') {\n self.player.seekTo(start || 0);\n }\n\n if (global$1.YT.PlayerState.PLAYING !== self.player.getPlayerState()) {\n self.player.playVideo();\n }\n }\n\n if (self.type === 'vimeo') {\n if (typeof start !== 'undefined') {\n self.player.setCurrentTime(start);\n }\n\n self.player.getPaused().then(paused => {\n if (paused) {\n self.player.play();\n }\n });\n }\n\n if (self.type === 'local') {\n if (typeof start !== 'undefined') {\n self.player.currentTime = start;\n }\n\n if (self.player.paused) {\n self.player.play();\n }\n }\n }\n\n pause() {\n const self = this;\n\n if (!self.player) {\n return;\n }\n\n if (self.type === 'youtube' && self.player.pauseVideo) {\n if (global$1.YT.PlayerState.PLAYING === self.player.getPlayerState()) {\n self.player.pauseVideo();\n }\n }\n\n if (self.type === 'vimeo') {\n self.player.getPaused().then(paused => {\n if (!paused) {\n self.player.pause();\n }\n });\n }\n\n if (self.type === 'local') {\n if (!self.player.paused) {\n self.player.pause();\n }\n }\n }\n\n mute() {\n const self = this;\n\n if (!self.player) {\n return;\n }\n\n if (self.type === 'youtube' && self.player.mute) {\n self.player.mute();\n }\n\n if (self.type === 'vimeo' && self.player.setVolume) {\n self.player.setVolume(0);\n }\n\n if (self.type === 'local') {\n self.$video.muted = true;\n }\n }\n\n unmute() {\n const self = this;\n\n if (!self.player) {\n return;\n }\n\n if (self.type === 'youtube' && self.player.mute) {\n self.player.unMute();\n }\n\n if (self.type === 'vimeo' && self.player.setVolume) {\n self.player.setVolume(self.options.volume);\n }\n\n if (self.type === 'local') {\n self.$video.muted = false;\n }\n }\n\n setVolume(volume = false) {\n const self = this;\n\n if (!self.player || !volume) {\n return;\n }\n\n if (self.type === 'youtube' && self.player.setVolume) {\n self.player.setVolume(volume);\n }\n\n if (self.type === 'vimeo' && self.player.setVolume) {\n self.player.setVolume(volume);\n }\n\n if (self.type === 'local') {\n self.$video.volume = volume / 100;\n }\n }\n\n getVolume(callback) {\n const self = this;\n\n if (!self.player) {\n callback(false);\n return;\n }\n\n if (self.type === 'youtube' && self.player.getVolume) {\n callback(self.player.getVolume());\n }\n\n if (self.type === 'vimeo' && self.player.getVolume) {\n self.player.getVolume().then(volume => {\n callback(volume);\n });\n }\n\n if (self.type === 'local') {\n callback(self.$video.volume * 100);\n }\n }\n\n getMuted(callback) {\n const self = this;\n\n if (!self.player) {\n callback(null);\n return;\n }\n\n if (self.type === 'youtube' && self.player.isMuted) {\n callback(self.player.isMuted());\n }\n\n if (self.type === 'vimeo' && self.player.getVolume) {\n self.player.getVolume().then(volume => {\n callback(!!volume);\n });\n }\n\n if (self.type === 'local') {\n callback(self.$video.muted);\n }\n }\n\n getImageURL(callback) {\n const self = this;\n\n if (self.videoImage) {\n callback(self.videoImage);\n return;\n }\n\n if (self.type === 'youtube') {\n const availableSizes = ['maxresdefault', 'sddefault', 'hqdefault', '0'];\n let step = 0;\n const tempImg = new Image();\n\n tempImg.onload = function () {\n // if no thumbnail, youtube add their own image with width = 120px\n if ((this.naturalWidth || this.width) !== 120 || step === availableSizes.length - 1) {\n // ok\n self.videoImage = `https://img.youtube.com/vi/${self.videoID}/${availableSizes[step]}.jpg`;\n callback(self.videoImage);\n } else {\n // try another size\n step += 1;\n this.src = `https://img.youtube.com/vi/${self.videoID}/${availableSizes[step]}.jpg`;\n }\n };\n\n tempImg.src = `https://img.youtube.com/vi/${self.videoID}/${availableSizes[step]}.jpg`;\n }\n\n if (self.type === 'vimeo') {\n let request = new XMLHttpRequest(); // https://vimeo.com/api/oembed.json?url=https://vimeo.com/235212527\n\n request.open('GET', `https://vimeo.com/api/oembed.json?url=${self.url}`, true);\n\n request.onreadystatechange = function () {\n if (this.readyState === 4) {\n if (this.status >= 200 && this.status < 400) {\n // Success!\n const response = JSON.parse(this.responseText);\n\n if (response.thumbnail_url) {\n self.videoImage = response.thumbnail_url;\n callback(self.videoImage);\n }\n }\n }\n };\n\n request.send();\n request = null;\n }\n } // fallback to the old version.\n\n\n getIframe(callback) {\n this.getVideo(callback);\n }\n\n getVideo(callback) {\n const self = this; // return generated video block\n\n if (self.$video) {\n callback(self.$video);\n return;\n } // generate new video block\n\n\n self.onAPIready(() => {\n let hiddenDiv;\n\n if (!self.$video) {\n hiddenDiv = document.createElement('div');\n hiddenDiv.style.display = 'none';\n } // Youtube\n\n\n if (self.type === 'youtube') {\n self.playerOptions = {\n // GDPR Compliance.\n host: 'https://www.youtube-nocookie.com',\n videoId: self.videoID,\n playerVars: {\n autohide: 1,\n rel: 0,\n autoplay: 0,\n // autoplay enable on mobile devices\n playsinline: 1\n }\n }; // hide controls\n\n if (!self.options.showControls) {\n self.playerOptions.playerVars.iv_load_policy = 3;\n self.playerOptions.playerVars.modestbranding = 1;\n self.playerOptions.playerVars.controls = 0;\n self.playerOptions.playerVars.showinfo = 0;\n self.playerOptions.playerVars.disablekb = 1;\n } // events\n\n\n let ytStarted;\n let ytProgressInterval;\n self.playerOptions.events = {\n onReady(e) {\n // mute\n if (self.options.mute) {\n e.target.mute();\n } else if (self.options.volume) {\n e.target.setVolume(self.options.volume);\n } // autoplay\n\n\n if (self.options.autoplay) {\n self.play(self.options.startTime);\n }\n\n self.fire('ready', e); // For seamless loops, set the endTime to 0.1 seconds less than the video's duration\n // https://github.com/nk-o/video-worker/issues/2\n\n if (self.options.loop && !self.options.endTime) {\n const secondsOffset = 0.1;\n self.options.endTime = self.player.getDuration() - secondsOffset;\n } // volumechange\n\n\n setInterval(() => {\n self.getVolume(volume => {\n if (self.options.volume !== volume) {\n self.options.volume = volume;\n self.fire('volumechange', e);\n }\n });\n }, 150);\n },\n\n onStateChange(e) {\n // loop\n if (self.options.loop && e.data === global$1.YT.PlayerState.ENDED) {\n self.play(self.options.startTime);\n }\n\n if (!ytStarted && e.data === global$1.YT.PlayerState.PLAYING) {\n ytStarted = 1;\n self.fire('started', e);\n }\n\n if (e.data === global$1.YT.PlayerState.PLAYING) {\n self.fire('play', e);\n }\n\n if (e.data === global$1.YT.PlayerState.PAUSED) {\n self.fire('pause', e);\n }\n\n if (e.data === global$1.YT.PlayerState.ENDED) {\n self.fire('ended', e);\n } // progress check\n\n\n if (e.data === global$1.YT.PlayerState.PLAYING) {\n ytProgressInterval = setInterval(() => {\n self.fire('timeupdate', e); // check for end of video and play again or stop\n\n if (self.options.endTime && self.player.getCurrentTime() >= self.options.endTime) {\n if (self.options.loop) {\n self.play(self.options.startTime);\n } else {\n self.pause();\n }\n }\n }, 150);\n } else {\n clearInterval(ytProgressInterval);\n }\n },\n\n onError(e) {\n self.fire('error', e);\n }\n\n };\n const firstInit = !self.$video;\n\n if (firstInit) {\n const div = document.createElement('div');\n div.setAttribute('id', self.playerID);\n hiddenDiv.appendChild(div);\n document.body.appendChild(hiddenDiv);\n }\n\n self.player = self.player || new global$1.YT.Player(self.playerID, self.playerOptions);\n\n if (firstInit) {\n self.$video = document.getElementById(self.playerID); // add accessibility attributes\n\n if (self.options.accessibilityHidden) {\n self.$video.setAttribute('tabindex', '-1');\n self.$video.setAttribute('aria-hidden', 'true');\n } // get video width and height\n\n\n self.videoWidth = parseInt(self.$video.getAttribute('width'), 10) || 1280;\n self.videoHeight = parseInt(self.$video.getAttribute('height'), 10) || 720;\n }\n } // Vimeo\n\n\n if (self.type === 'vimeo') {\n self.playerOptions = {\n // GDPR Compliance.\n dnt: 1,\n id: self.videoID,\n autopause: 0,\n transparent: 0,\n autoplay: self.options.autoplay ? 1 : 0,\n loop: self.options.loop ? 1 : 0,\n muted: self.options.mute ? 1 : 0\n };\n\n if (self.options.volume) {\n self.playerOptions.volume = self.options.volume;\n } // hide controls\n\n\n if (!self.options.showControls) {\n self.playerOptions.badge = 0;\n self.playerOptions.byline = 0;\n self.playerOptions.portrait = 0;\n self.playerOptions.title = 0;\n self.playerOptions.background = 1;\n }\n\n if (!self.$video) {\n let playerOptionsString = '';\n Object.keys(self.playerOptions).forEach(key => {\n if (playerOptionsString !== '') {\n playerOptionsString += '&';\n }\n\n playerOptionsString += `${key}=${encodeURIComponent(self.playerOptions[key])}`;\n }); // we need to create iframe manually because when we create it using API\n // js events won't triggers after iframe moved to another place\n\n self.$video = document.createElement('iframe');\n self.$video.setAttribute('id', self.playerID);\n self.$video.setAttribute('src', `https://player.vimeo.com/video/${self.videoID}?${playerOptionsString}`);\n self.$video.setAttribute('frameborder', '0');\n self.$video.setAttribute('mozallowfullscreen', '');\n self.$video.setAttribute('allowfullscreen', '');\n self.$video.setAttribute('title', 'Vimeo video player'); // add accessibility attributes\n\n if (self.options.accessibilityHidden) {\n self.$video.setAttribute('tabindex', '-1');\n self.$video.setAttribute('aria-hidden', 'true');\n }\n\n hiddenDiv.appendChild(self.$video);\n document.body.appendChild(hiddenDiv);\n }\n\n self.player = self.player || new global$1.Vimeo.Player(self.$video, self.playerOptions); // set current time for autoplay\n\n if (self.options.startTime && self.options.autoplay) {\n self.player.setCurrentTime(self.options.startTime);\n } // get video width and height\n\n\n self.player.getVideoWidth().then(width => {\n self.videoWidth = width || 1280;\n });\n self.player.getVideoHeight().then(height => {\n self.videoHeight = height || 720;\n }); // events\n\n let vmStarted;\n self.player.on('timeupdate', e => {\n if (!vmStarted) {\n self.fire('started', e);\n vmStarted = 1;\n }\n\n self.fire('timeupdate', e); // check for end of video and play again or stop\n\n if (self.options.endTime) {\n if (self.options.endTime && e.seconds >= self.options.endTime) {\n if (self.options.loop) {\n self.play(self.options.startTime);\n } else {\n self.pause();\n }\n }\n }\n });\n self.player.on('play', e => {\n self.fire('play', e); // check for the start time and start with it\n\n if (self.options.startTime && e.seconds === 0) {\n self.play(self.options.startTime);\n }\n });\n self.player.on('pause', e => {\n self.fire('pause', e);\n });\n self.player.on('ended', e => {\n self.fire('ended', e);\n });\n self.player.on('loaded', e => {\n self.fire('ready', e);\n });\n self.player.on('volumechange', e => {\n self.fire('volumechange', e);\n });\n self.player.on('error', e => {\n self.fire('error', e);\n });\n } // Local\n\n\n function addSourceToLocal(element, src, type) {\n const source = document.createElement('source');\n source.src = src;\n source.type = type;\n element.appendChild(source);\n }\n\n if (self.type === 'local') {\n if (!self.$video) {\n self.$video = document.createElement('video'); // show controls\n\n if (self.options.showControls) {\n self.$video.controls = true;\n } // mute\n\n\n if (self.options.mute) {\n self.$video.muted = true;\n } else if (self.$video.volume) {\n self.$video.volume = self.options.volume / 100;\n } // loop\n\n\n if (self.options.loop) {\n self.$video.loop = true;\n } // autoplay enable on mobile devices\n\n\n self.$video.setAttribute('playsinline', '');\n self.$video.setAttribute('webkit-playsinline', ''); // add accessibility attributes\n\n if (self.options.accessibilityHidden) {\n self.$video.setAttribute('tabindex', '-1');\n self.$video.setAttribute('aria-hidden', 'true');\n }\n\n self.$video.setAttribute('id', self.playerID);\n hiddenDiv.appendChild(self.$video);\n document.body.appendChild(hiddenDiv);\n Object.keys(self.videoID).forEach(key => {\n addSourceToLocal(self.$video, self.videoID[key], `video/${key}`);\n });\n }\n\n self.player = self.player || self.$video;\n let locStarted;\n self.player.addEventListener('playing', e => {\n if (!locStarted) {\n self.fire('started', e);\n }\n\n locStarted = 1;\n });\n self.player.addEventListener('timeupdate', function (e) {\n self.fire('timeupdate', e); // check for end of video and play again or stop\n\n if (self.options.endTime) {\n if (self.options.endTime && this.currentTime >= self.options.endTime) {\n if (self.options.loop) {\n self.play(self.options.startTime);\n } else {\n self.pause();\n }\n }\n }\n });\n self.player.addEventListener('play', e => {\n self.fire('play', e);\n });\n self.player.addEventListener('pause', e => {\n self.fire('pause', e);\n });\n self.player.addEventListener('ended', e => {\n self.fire('ended', e);\n });\n self.player.addEventListener('loadedmetadata', function () {\n // get video width and height\n self.videoWidth = this.videoWidth || 1280;\n self.videoHeight = this.videoHeight || 720;\n self.fire('ready'); // autoplay\n\n if (self.options.autoplay) {\n self.play(self.options.startTime);\n }\n });\n self.player.addEventListener('volumechange', e => {\n self.getVolume(volume => {\n self.options.volume = volume;\n });\n self.fire('volumechange', e);\n });\n self.player.addEventListener('error', e => {\n self.fire('error', e);\n });\n }\n\n callback(self.$video);\n });\n }\n\n init() {\n const self = this;\n self.playerID = `VideoWorker-${self.ID}`;\n }\n\n loadAPI() {\n const self = this;\n\n if (YoutubeAPIadded && VimeoAPIadded) {\n return;\n }\n\n let src = ''; // load Youtube API\n\n if (self.type === 'youtube' && !YoutubeAPIadded) {\n YoutubeAPIadded = 1;\n src = 'https://www.youtube.com/iframe_api';\n } // load Vimeo API\n\n\n if (self.type === 'vimeo' && !VimeoAPIadded) {\n VimeoAPIadded = 1; // Useful when Vimeo API added using RequireJS https://github.com/nk-o/video-worker/pull/7\n\n if (typeof global$1.Vimeo !== 'undefined') {\n return;\n }\n\n src = 'https://player.vimeo.com/api/player.js';\n }\n\n if (!src) {\n return;\n } // add script in head section\n\n\n let tag = document.createElement('script');\n let head = document.getElementsByTagName('head')[0];\n tag.src = src;\n head.appendChild(tag);\n head = null;\n tag = null;\n }\n\n onAPIready(callback) {\n const self = this; // Youtube\n\n if (self.type === 'youtube') {\n // Listen for global YT player callback\n if ((typeof global$1.YT === 'undefined' || global$1.YT.loaded === 0) && !loadingYoutubePlayer) {\n // Prevents Ready event from being called twice\n loadingYoutubePlayer = 1; // Creates deferred so, other players know when to wait.\n\n global$1.onYouTubeIframeAPIReady = function () {\n global$1.onYouTubeIframeAPIReady = null;\n loadingYoutubeDefer.resolve('done');\n callback();\n };\n } else if (typeof global$1.YT === 'object' && global$1.YT.loaded === 1) {\n callback();\n } else {\n loadingYoutubeDefer.done(() => {\n callback();\n });\n }\n } // Vimeo\n\n\n if (self.type === 'vimeo') {\n if (typeof global$1.Vimeo === 'undefined' && !loadingVimeoPlayer) {\n loadingVimeoPlayer = 1;\n const vimeoInterval = setInterval(() => {\n if (typeof global$1.Vimeo !== 'undefined') {\n clearInterval(vimeoInterval);\n loadingVimeoDefer.resolve('done');\n callback();\n }\n }, 20);\n } else if (typeof global$1.Vimeo !== 'undefined') {\n callback();\n } else {\n loadingVimeoDefer.done(() => {\n callback();\n });\n }\n } // Local\n\n\n if (self.type === 'local') {\n callback();\n }\n }\n\n}\n\nexport { VideoWorker as default };\n//# sourceMappingURL=video-worker.esm.js.map\n","function ready(callback) {\n if ('complete' === document.readyState || 'interactive' === document.readyState) {\n // Already ready or interactive, execute callback\n callback();\n } else {\n document.addEventListener('DOMContentLoaded', callback, {\n capture: true,\n once: true,\n passive: true,\n });\n }\n}\n\nexport default ready;\n","/* eslint-disable import/no-mutable-exports */\n/* eslint-disable no-restricted-globals */\nlet win;\n\nif ('undefined' !== typeof window) {\n win = window;\n} else if ('undefined' !== typeof global) {\n win = global;\n} else if ('undefined' !== typeof self) {\n win = self;\n} else {\n win = {};\n}\n\nexport default win;\n","import VideoWorker from 'video-worker';\n\nimport global from './utils/global';\n\nfunction jarallaxVideo(jarallax = global.jarallax) {\n if ('undefined' === typeof jarallax) {\n return;\n }\n\n const Jarallax = jarallax.constructor;\n\n // append video after when block will be visible.\n const defOnScroll = Jarallax.prototype.onScroll;\n Jarallax.prototype.onScroll = function () {\n const self = this;\n\n defOnScroll.apply(self);\n\n const isReady =\n !self.isVideoInserted &&\n self.video &&\n (!self.options.videoLazyLoading || self.isElementInViewport) &&\n !self.options.disableVideo();\n\n if (isReady) {\n self.isVideoInserted = true;\n\n self.video.getVideo((video) => {\n const $parent = video.parentNode;\n self.css(video, {\n position: self.image.position,\n top: '0px',\n left: '0px',\n right: '0px',\n bottom: '0px',\n width: '100%',\n height: '100%',\n maxWidth: 'none',\n maxHeight: 'none',\n pointerEvents: 'none',\n transformStyle: 'preserve-3d',\n backfaceVisibility: 'hidden',\n willChange: 'transform,opacity',\n margin: 0,\n zIndex: -1,\n });\n self.$video = video;\n\n // add Poster attribute to self-hosted video\n if ('local' === self.video.type) {\n if (self.image.src) {\n self.$video.setAttribute('poster', self.image.src);\n } else if (\n self.image.$item &&\n 'IMG' === self.image.$item.tagName &&\n self.image.$item.src\n ) {\n self.$video.setAttribute('poster', self.image.$item.src);\n }\n }\n\n // insert video tag\n self.image.$container.appendChild(video);\n\n // remove parent video element (created by VideoWorker)\n $parent.parentNode.removeChild($parent);\n\n // call onVideoInsert event\n if (self.options.onVideoInsert) {\n self.options.onVideoInsert.call(self);\n }\n });\n }\n };\n\n // cover video\n const defCoverImage = Jarallax.prototype.coverImage;\n Jarallax.prototype.coverImage = function () {\n const self = this;\n const imageData = defCoverImage.apply(self);\n const node = self.image.$item ? self.image.$item.nodeName : false;\n\n if (imageData && self.video && node && ('IFRAME' === node || 'VIDEO' === node)) {\n let h = imageData.image.height;\n let w = (h * self.image.width) / self.image.height;\n let ml = (imageData.container.width - w) / 2;\n let mt = imageData.image.marginTop;\n\n if (imageData.container.width > w) {\n w = imageData.container.width;\n h = (w * self.image.height) / self.image.width;\n ml = 0;\n mt += (imageData.image.height - h) / 2;\n }\n\n // add video height over than need to hide controls\n if ('IFRAME' === node) {\n h += 400;\n mt -= 200;\n }\n\n self.css(self.$video, {\n width: `${w}px`,\n marginLeft: `${ml}px`,\n height: `${h}px`,\n marginTop: `${mt}px`,\n });\n }\n\n return imageData;\n };\n\n // init video\n const defInitImg = Jarallax.prototype.initImg;\n Jarallax.prototype.initImg = function () {\n const self = this;\n const defaultResult = defInitImg.apply(self);\n\n if (!self.options.videoSrc) {\n self.options.videoSrc = self.$item.getAttribute('data-jarallax-video') || null;\n }\n\n if (self.options.videoSrc) {\n self.defaultInitImgResult = defaultResult;\n return true;\n }\n\n return defaultResult;\n };\n\n const defCanInitParallax = Jarallax.prototype.canInitParallax;\n Jarallax.prototype.canInitParallax = function () {\n const self = this;\n let defaultResult = defCanInitParallax.apply(self);\n\n if (!self.options.videoSrc) {\n return defaultResult;\n }\n\n // Init video api\n const video = new VideoWorker(self.options.videoSrc, {\n autoplay: true,\n loop: self.options.videoLoop,\n showControls: false,\n accessibilityHidden: true,\n startTime: self.options.videoStartTime || 0,\n endTime: self.options.videoEndTime || 0,\n mute: self.options.videoVolume ? 0 : 1,\n volume: self.options.videoVolume || 0,\n });\n\n // call onVideoWorkerInit event\n if (self.options.onVideoWorkerInit) {\n self.options.onVideoWorkerInit.call(self, video);\n }\n\n function resetDefaultImage() {\n if (self.image.$default_item) {\n self.image.$item = self.image.$default_item;\n self.image.$item.style.display = 'block';\n\n // set image width and height\n self.coverImage();\n self.onScroll();\n }\n }\n\n if (video.isValid()) {\n // Force enable parallax.\n // When the parallax disabled on mobile devices, we still need to display videos.\n // https://github.com/nk-o/jarallax/issues/159\n if (this.options.disableParallax()) {\n defaultResult = true;\n self.image.position = 'absolute';\n self.options.type = 'scroll';\n self.options.speed = 1;\n }\n\n // if parallax will not be inited, we can add thumbnail on background.\n if (!defaultResult) {\n if (!self.defaultInitImgResult) {\n video.getImageURL((url) => {\n // save default user styles\n const curStyle = self.$item.getAttribute('style');\n if (curStyle) {\n self.$item.setAttribute('data-jarallax-original-styles', curStyle);\n }\n\n // set new background\n self.css(self.$item, {\n 'background-image': `url(\"${url}\")`,\n 'background-position': 'center',\n 'background-size': 'cover',\n });\n });\n }\n\n // init video\n } else {\n video.on('ready', () => {\n if (self.options.videoPlayOnlyVisible) {\n const oldOnScroll = self.onScroll;\n self.onScroll = function () {\n oldOnScroll.apply(self);\n if (\n !self.videoError &&\n (self.options.videoLoop || (!self.options.videoLoop && !self.videoEnded))\n ) {\n if (self.isVisible()) {\n video.play();\n } else {\n video.pause();\n }\n }\n };\n } else {\n video.play();\n }\n });\n video.on('started', () => {\n self.image.$default_item = self.image.$item;\n self.image.$item = self.$video;\n\n // set video width and height\n self.image.width = self.video.videoWidth || 1280;\n self.image.height = self.video.videoHeight || 720;\n self.coverImage();\n self.onScroll();\n\n // hide image\n if (self.image.$default_item) {\n self.image.$default_item.style.display = 'none';\n }\n });\n\n video.on('ended', () => {\n self.videoEnded = true;\n\n if (!self.options.videoLoop) {\n // show default image if Loop disabled.\n resetDefaultImage();\n }\n });\n video.on('error', () => {\n self.videoError = true;\n\n // show default image if video loading error.\n resetDefaultImage();\n });\n\n self.video = video;\n\n // set image if not exists\n if (!self.defaultInitImgResult) {\n // set empty image on self-hosted video if not defined\n self.image.src =\n 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7';\n\n if ('local' !== video.type) {\n video.getImageURL((url) => {\n self.image.bgImage = `url(\"${url}\")`;\n self.init();\n });\n\n return false;\n }\n }\n }\n }\n\n return defaultResult;\n };\n\n // Destroy video parallax\n const defDestroy = Jarallax.prototype.destroy;\n Jarallax.prototype.destroy = function () {\n const self = this;\n\n if (self.image.$default_item) {\n self.image.$item = self.image.$default_item;\n delete self.image.$default_item;\n }\n\n defDestroy.apply(self);\n };\n}\n\nexport default jarallaxVideo;\n","import VideoWorker from 'video-worker';\n\nimport domReady from './utils/ready';\nimport global from './utils/global';\nimport jarallaxVideo from './ext-video';\n\njarallaxVideo();\n\n// data-jarallax-video initialization\ndomReady(() => {\n if ('undefined' !== typeof global.jarallax) {\n global.jarallax(document.querySelectorAll('[data-jarallax-video]'));\n }\n});\n\n// We should add VideoWorker globally, since some project uses it.\nif (!global.VideoWorker) {\n global.VideoWorker = VideoWorker;\n}\n\nexport default jarallaxVideo;\n"],"names":["win","window","global","self","ready","callback","document","readyState","addEventListener","capture","once","passive","jarallaxVideo","jarallax","Jarallax","constructor","defOnScroll","prototype","onScroll","apply","isReady","isVideoInserted","video","options","videoLazyLoading","isElementInViewport","disableVideo","getVideo","$parent","parentNode","css","position","image","top","left","right","bottom","width","height","maxWidth","maxHeight","pointerEvents","transformStyle","backfaceVisibility","willChange","margin","zIndex","$video","type","src","setAttribute","$item","tagName","$container","appendChild","removeChild","onVideoInsert","call","defCoverImage","coverImage","imageData","node","nodeName","h","w","ml","container","mt","marginTop","marginLeft","defInitImg","initImg","defaultResult","videoSrc","getAttribute","defaultInitImgResult","defCanInitParallax","canInitParallax","VideoWorker","autoplay","loop","videoLoop","showControls","accessibilityHidden","startTime","videoStartTime","endTime","videoEndTime","mute","videoVolume","volume","onVideoWorkerInit","resetDefaultImage","$default_item","style","display","isValid","disableParallax","speed","getImageURL","url","curStyle","on","videoPlayOnlyVisible","oldOnScroll","videoError","videoEnded","isVisible","play","pause","videoWidth","videoHeight","bgImage","init","defDestroy","destroy","domReady","querySelectorAll"],"mappings":";;;;;;;;;;;;;;;;;;;EAAA;;EACA;EACA,IAAIA,KAAJ;;EAEA,IAAI,OAAOC,MAAP,KAAkB,WAAtB,EAAmC;EACjCD,OAAG,GAAGC,MAAND;EADF,OAEO,IAAI,OAAOE,MAAP,KAAkB,WAAtB,EAAmC;EACxCF,OAAG,GAAGE,MAANF;EADK,OAEA,IAAI,OAAOG,IAAP,KAAgB,WAApB,EAAiC;EACtCH,OAAG,GAAGG,IAANH;EADK,OAEA;EACLA,OAAG,GAAG,EAANA;EACD;;EAED,iBAAeA,KAAf;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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