{"version":3,"names":["controlsCss","EonUiVideoplayerControlsStyle0","VideoplayerControls","handleSeek","e","clientX","currentTarget","left","width","getBoundingClientRect","seekPercent","seekSecond","this","duration","seekEvent","emit","percent","seconds","render","percentPlayedLabel","stringFormat","_a","currentLocalization","percentPlayed","String","h","key","class","pfx","controls","fullscreen","isFullscreen","title","_b","togglePlayPause","type","onClick","_e","x","y","playToggleEvent","name","isPlaying","_c","max","value","tabIndex","formatTime","secondsPlayed","hideMuteButton","muteToggleEvent","_d","toggleMute","isMuted","_f","hideFullscreenButton","fullscreenToggleEvent","_g","toggleFullscreen","_h","playerSharedCss","EonUiVideoplayerFileStyle0","filePlayerCss","EonUiVideoplayerFileStyle1","FilePlayer","handleNativePlayerFullscreenChange","nativePlayerFullscreenChangeEvent","componentWillLoad","VIDEOPLAYER_TYPE_MOVING_IMAGE","createPlayer","VIDEOPLAYER_TYPE_FILE","resolvedSource","source","componentDidLoad","isSafari","videoElement","addEventListener","disconnectedCallback","removeEventListener","fetch","method","then","response","json","videoSourcesJson","catch","error","webComponentsDebug","console","log","errorEvent","htmlVideoSource","videoSources","html","length","handleIsMutedChanged","muted","handleSeekTimeChanged","currentTime","seekTime","handleCanPlay","canPlayEvent","handleLoadedMetaData","handleEnded","load","endedEvent","handleError","handleTimeUpdate","Math","round","timeUpdateEvent","handleOnPlay","play","playEvent","handleOnPause","pause","pauseEvent","handleIsPlayingChanged","sources","Fragment","src","onError","videoTagNotSupported","defaultProps","ref","el","onCanPlay","onPlay","onPause","onLoadedMetaData","onEnded","onTimeUpdate","videoPlayerProps","autoplay","defaultMuted","loop","playsInline","autoPlay","preload","youtubePlayerCss","EonUiYoutubeplayerStyle0","EonUiYoutubeplayerStyle1","YouTubePlayer","isIosMobileDevice","isIphoneOrIpod","initVideo","handleHideControlsChanged","hideControls","player","playVideo","getIframe","classList","add","remove","mute","unMute","handleAutoplayChanged","seekTo","handleStateChange","event","data","YT","PlayerState","PLAYING","PAUSED","ENDED","UNSTARTED","BUFFERING","iframeAPIScript","document","createElement","firstScriptTag","getElementsByTagName","parentNode","insertBefore","window","callback","push","forEach","splice","Player","youtubeElement","videoId","host","noCookie","playerVars","cc_load_policy","captions","cc_lang_pref","languageCode","modestbranding","disablekb","rel","showinfo","fs","iv_load_policy","playsinline","events","onReady","cueVideoById","onStateChange","handleApiChange","loadModule","getOption","getDuration","time_update_interval","clearInterval","setInterval","getCurrentTime","pauseVideo","id"],"sources":["src/components/videoplayer/controls/controls.scss?tag=eon-ui-videoplayer-controls","src/components/videoplayer/controls/controls.tsx","src/components/videoplayer/players/player-shared.scss?tag=eon-ui-videoplayer-file","src/components/videoplayer/players/file/file-player.scss?tag=eon-ui-videoplayer-file","src/components/videoplayer/players/file/file-player.tsx","src/components/videoplayer/players/youtube/youtube-player.scss?tag=eon-ui-youtubeplayer","src/components/videoplayer/players/player-shared.scss?tag=eon-ui-youtubeplayer","src/components/videoplayer/players/youtube/youtube-player.tsx"],"sourcesContent":["$controls-height: 48px;\n$controls-overlap-collapsed: 4px; // Controls how much the control bar is overlappping the video when collapsed\n\n.#{$prefix}videoplayer {\n &:focus .#{$prefix}controls,\n &:hover .#{$prefix}controls {\n bottom: 0;\n transition: bottom 0.25s ease-in;\n }\n\n .#{$prefix}controls {\n background: $videoplayer-controls-background;\n bottom: -$controls-height + $controls-overlap-collapsed;\n display: flex;\n flex-wrap: nowrap;\n height: $controls-height;\n left: 0;\n margin: 0 auto;\n max-width: 100%;\n position: absolute;\n right: 0;\n transition: bottom 0.25s ease-in 2s;\n width: 100%;\n z-index: 1;\n\n &.#{$prefix}fullscreen {\n @include for-size(desktop-or-larger) {\n width: 80%;\n }\n }\n\n .#{$prefix}progress-bar {\n background: $videoplayer-progress-bar-background;\n flex-grow: 1;\n\n &:active {\n background: $videoplayer-progress-bar-active-background;\n }\n\n .#{$prefix}progress-bar-time {\n align-items: center;\n bottom: 0;\n color: $videoplayer-progress-bar-time-color;\n display: flex;\n font-size: 18px;\n font-weight: 500;\n left: 0;\n pointer-events: none;\n position: absolute;\n top: 0;\n width: 100%;\n justify-content: center;\n }\n\n progress {\n -webkit-appearance: none;\n -moz-appearance: none;\n appearance: none;\n background-color: $videoplayer-progress-background; // required by IE, Edge & FF\n border: none;\n border-radius: 0;\n color: $videoplayer-progress-color; // required by IE, Edge\n height: 100%;\n padding: 0;\n width: 100%;\n }\n\n progress::-webkit-progress-bar {\n background-color: $videoplayer-progress-background;\n }\n\n progress::-webkit-progress-value {\n background-color: $videoplayer-progress-bar-value-background;\n }\n\n progress::-moz-progress-bar {\n background-color: $videoplayer-progress-bar-background;\n }\n\n progress::-ms-fill {\n border-color: currentColor; // remove IE default border-right of value\n }\n }\n\n .#{$prefix}button {\n border: 0;\n color: $videoplayer-progress-bar-button-color;\n font-size: 1.8em;\n padding: 0;\n transition: 0.5s background;\n width: $controls-height;\n\n eon-ui-icon {\n margin-left: 8px;\n }\n\n &.#{$prefix}play {\n background: $videoplayer-progress-bar-play-button-background;\n\n eon-ui-icon {\n color: $videoplayer-icon-color;\n }\n\n &:active,\n &:hover {\n background: $videoplayer-progress-bar-play-button-hover-background;\n }\n\n &:focus {\n outline: 2px solid $videoplayer-progress-bar-button-focus;\n outline-offset: -4px;\n }\n\n @include for-size(tablet-or-larger) {\n &:active,\n &:hover {\n background: $videoplayer-progress-bar-play-button-hover-background;\n }\n }\n }\n\n &.#{$prefix}mute {\n background: $videoplayer-progress-bar-mute-button-background;\n\n eon-ui-icon {\n color: $videoplayer-icon-color;\n }\n\n @include for-size(phone) {\n display: none;\n }\n\n &:active,\n &:hover {\n background: $videoplayer-progress-bar-mute-button-hover-background;\n }\n\n &:focus {\n outline: 2px solid $videoplayer-progress-bar-button-focus;\n outline-offset: -4px;\n }\n\n @include for-size(tablet-or-larger) {\n &:active,\n &:hover {\n background: $videoplayer-progress-bar-mute-button-background;\n }\n }\n }\n\n &.#{$prefix}fullscreen {\n background: $videoplayer-progress-bar-full-screen-button-background;\n\n eon-ui-icon {\n color: $videoplayer-icon-color;\n }\n\n &:active,\n &:hover {\n background: $videoplayer-progress-bar-full-screen-button-hover-background;\n }\n\n &:focus {\n outline: 2px solid $videoplayer-progress-bar-button-focus;\n outline-offset: -4px;\n }\n\n @include for-size(tablet-or-larger) {\n &:active,\n &:hover {\n background: $videoplayer-progress-bar-full-screen-button-background;\n }\n }\n\n .#{$prefix}eon_fullscreen_exit {\n margin-left: -1px;\n padding-top: 2px;\n }\n }\n }\n }\n\n &.#{$prefix}is-touch {\n .#{$prefix}playing ~ eon-ui-videoplayer-controls .#{$prefix}controls {\n bottom: -$controls-height + $controls-overlap-collapsed;\n }\n }\n}\n","/* eslint-disable jsx-a11y/no-noninteractive-element-interactions */\nimport { Component, Element, Event, EventEmitter, h, Prop } from \"@stencil/core\";\nimport { VideoplayerLocalization, VideoplayerProgressEventArgs } from \"../constants/videoplayer-types\";\nimport { formatTime } from \"../../../utils/date-helper\";\nimport { stringFormat } from \"../../../utils/string-format\";\nimport pfx from \"../../../utils/style-class-prefix-helper\";\n// import { InitLogging } from \"../../../decorators/init-logging\";\n\n@Component({\n tag: \"eon-ui-videoplayer-controls\",\n styleUrl: \"controls.scss\",\n shadow: false\n})\nexport class VideoplayerControls {\n // @InitLogging() sentryTransaction;\n\n @Element() hostElement: HTMLEonUiVideoplayerControlsElement;\n\n /**\n *\n */\n @Event() fullscreenToggleEvent: EventEmitter;\n\n /**\n *\n */\n @Event() muteToggleEvent: EventEmitter;\n\n /**\n *\n */\n @Event() playToggleEvent: EventEmitter;\n\n /**\n *\n */\n @Event() seekEvent: EventEmitter;\n\n /**\n *\n */\n @Prop() duration: number;\n\n /**\n *\n */\n @Prop() isFullscreen: boolean;\n\n /**\n *\n */\n @Prop() isMuted: boolean;\n\n /**\n *\n */\n @Prop() isPlaying: boolean;\n\n /**\n *\n */\n @Prop() percentPlayed: number;\n\n /**\n *\n */\n @Prop() secondsPlayed: number;\n\n /**\n *\n */\n @Prop() hideMuteButton: boolean;\n\n /**\n *\n */\n @Prop() currentLocalization: VideoplayerLocalization;\n\n /**\n *\n */\n @Prop() hideFullscreenButton: boolean;\n\n handleSeek(e: MouseEvent): void {\n const { clientX, currentTarget } = e;\n const { left, width } = (currentTarget as Element).getBoundingClientRect();\n const seekPercent = ((clientX - left) / width) * 100;\n const seekSecond = (seekPercent / 100) * this.duration;\n\n this.seekEvent.emit({ percent: seekPercent, seconds: seekSecond });\n }\n\n render() {\n const percentPlayedLabel = stringFormat(this.currentLocalization?.percentPlayed, String(this.percentPlayed));\n\n return (\n \n {/* Play/Pause button */}\n {\n if (_e.x === 0 && _e.y === 0) return;\n this.playToggleEvent.emit();\n }}\n >\n \n \n\n {/* Progress bar */}\n
\n {/* eslint-disable-next-line jsx-a11y/click-events-have-key-events */}\n this.handleSeek(e)}\n value={this.percentPlayed || 0}\n /* eslint-disable-next-line */\n tabIndex={0}\n >\n {/* for ScreenReaders: */}\n {percentPlayedLabel}\n \n \n {`${formatTime(this.secondsPlayed || 0)}/${formatTime(this.duration || 0)}`}\n \n
\n\n {/* Mute/Unmute button */}\n {!this.hideMuteButton && (\n this.muteToggleEvent.emit()}\n title={this.currentLocalization?.toggleMute}\n >\n \n \n )}\n {/* Toggle Fullscreen button */}\n {!this.hideFullscreenButton && (\n this.fullscreenToggleEvent.emit()}\n title={this.currentLocalization?.toggleFullscreen}\n >\n \n \n )}\n \n );\n }\n}\n","video {\r\n display: block;\r\n height: 100%;\r\n min-width: 100%;\r\n position: relative;\r\n object-fit: cover;\r\n object-position: center center;\r\n}\r\n",".#{$prefix}fullscreen-safari {\r\n transform: unset !important;\r\n}\r\n","import { Component, Element, Event, EventEmitter, h, Prop, Watch, State } from \"@stencil/core\";\nimport Fragment from \"../../../../common/fragment\";\nimport {\n VideoplayerProgressEventArgs,\n VideoplayerLocalization,\n VideoPlayerType\n} from \"../../constants/videoplayer-types\";\nimport { Player } from \"../player\";\nimport { isSafari } from \"../../../../utils/device-helper\";\nimport pfx from \"../../../../utils/style-class-prefix-helper\";\nimport { VIDEOPLAYER_TYPE_FILE, VIDEOPLAYER_TYPE_MOVING_IMAGE } from \"../../constants/videoplayer-constants\";\nimport webComponentsDebug from \"../../../../utils/log-helper\";\n// import { InitLogging } from \"../../../../decorators/init-logging\";\n\n@Component({\n tag: \"eon-ui-videoplayer-file\",\n styleUrls: [\"../player-shared.scss\", \"file-player.scss\"],\n shadow: false\n})\nexport class FilePlayer implements Player {\n // @InitLogging() sentryTransaction;\n\n @Element() hostElement: HTMLEonUiVideoplayerFileElement;\n private videoElement: HTMLVideoElement;\n\n @State() videoSourcesJson: any;\n @State() resolvedSource: any;\n\n /**\n * Raised when the browser finished analyzing the video and can start playing, meaning it has buffered enough to begin.\n * Emits the total length of the video in seconds.\n */\n @Event() canPlayEvent: EventEmitter;\n\n /**\n * Raised when the video has reached the end.\n */\n @Event() endedEvent: EventEmitter;\n\n /**\n * Raised when the video resource could not be loaded due to an error (e.g. a network error).\n */\n @Event() errorEvent: EventEmitter;\n\n /**\n * Raised when the time indicated by the currentTime attribute of the video has been updated.\n * This is triggered very frequently to keep the progress bar up2date.\n */\n @Event() timeUpdateEvent: EventEmitter;\n\n /**\n * Raised when a native video player (e.g. in Safari) toggles the fullscreen mode without using the custom E.ON videoplayer controls.\n */\n @Event() nativePlayerFullscreenChangeEvent: EventEmitter;\n\n /**\n * The pauseEvent is fired when the video is paused via youtube button or customised control bar\n */\n @Event() pauseEvent: EventEmitter;\n\n /**\n * The playEvent is fired when the video is played via youtube button or customised control bar\n */\n @Event() playEvent: EventEmitter;\n\n /**\n * Flexibility to editor for choosing player: file player or moving image player?\n */\n @Prop() type: VideoPlayerType;\n\n /**\n * Set to true if the player should attempt to autoplay the video.\n * This doesn't work on iPhones and requires the video to be muted as well.\n */\n @Prop() autoplay: boolean;\n\n /**\n * Controls whether the video is muted or not.\n */\n @Prop() isMuted: boolean;\n\n /**\n * Controls whether the video is currently playing or not.\n * Set to false to pause the video.\n */\n @Prop() isPlaying: boolean;\n\n /**\n * The seconds at which the video should play.\n */\n @Prop() seekTime: number;\n\n /**\n * The source URL of the video.\n */\n @Prop() source: string;\n\n /**\n * Determines whether the video is currently displayed in fullscreen mode or not.\n */\n @Prop() isFullscreen: boolean;\n\n /**\n * Translated strings in the language currently selected.\n */\n @Prop() currentLocalization: VideoplayerLocalization;\n\n componentWillLoad() {\n if (this.type === VIDEOPLAYER_TYPE_MOVING_IMAGE) {\n this.createPlayer();\n } else if (this.type === VIDEOPLAYER_TYPE_FILE) {\n this.resolvedSource = this.source;\n }\n }\n\n componentDidLoad() {\n if (isSafari()) {\n this.videoElement.addEventListener(\"webkitbeginfullscreen\", this.handleNativePlayerFullscreenChange); //iPad\n this.videoElement.addEventListener(\"webkitfullscreenchange\", this.handleNativePlayerFullscreenChange); // Desktop\n }\n }\n\n disconnectedCallback() {\n if (isSafari()) {\n this.videoElement.removeEventListener(\"webkitbeginfullscreen\", this.handleNativePlayerFullscreenChange);\n this.videoElement.removeEventListener(\"webkitfullscreenchange\", this.handleNativePlayerFullscreenChange);\n }\n }\n\n /**\n * Reference for MovingImage REST API:\n * @Here: https://doc.movingimage.com/display/LT/movingimage+Playout+API#/reference/0/get-playout-video/get-playout-video\n * This Returns API response which is then fetched in the form of JSON and accordingly video source is retrieved.\n */\n @Watch(\"type\")\n @Watch(\"source\")\n async createPlayer() {\n await fetch(`https://d.video-cdn.net/play/public/v1/video/${this.source}`, {\n method: \"GET\"\n }).then((response) =>\n response\n .json()\n .then((json) => {\n this.videoSourcesJson = json;\n })\n .catch((error) => {\n if (webComponentsDebug) {\n console.log(`MovingImage URL for video ID: ${this.source} failed to resolve: ${error}`);\n }\n // Here is errorEvent is fired for invalid MovingImage VideoIds\n this.errorEvent.emit();\n })\n );\n const htmlVideoSource = this.videoSourcesJson?.videoSources?.html[\"720p\"] || null;\n this.resolvedSource = (htmlVideoSource?.length && htmlVideoSource[0]?.source) || null;\n return this.resolvedSource;\n }\n\n handleNativePlayerFullscreenChange = (_e: Event) => {\n this.nativePlayerFullscreenChangeEvent.emit();\n };\n\n @Watch(\"isMuted\")\n handleIsMutedChanged() {\n this.videoElement.muted = this.isMuted;\n }\n\n @Watch(\"seekTime\")\n handleSeekTimeChanged() {\n this.videoElement.currentTime = this.seekTime;\n }\n\n private handleCanPlay(_e: Event): void {\n this.canPlayEvent.emit(this.videoElement.duration);\n }\n\n private handleLoadedMetaData(_e: Event): void {\n // Safari doesn't fire handleCanPlay, so we have to use handleLoadedMetaData instead.\n if (isSafari()) {\n this.canPlayEvent.emit(this.videoElement.duration);\n }\n }\n\n private handleEnded(_e: Event): void {\n // Reloads the video so that the poster-image is shown again after play.\n // This isn't browser default behaviour and therefore needs this workaround.\n // It shouldn't be a performance problem though because the video is always cached.\n this.videoElement.load();\n this.endedEvent.emit();\n }\n\n private handleError(_e: Event): void {\n if (this.type === VIDEOPLAYER_TYPE_FILE) {\n this.errorEvent.emit();\n }\n }\n\n private handleTimeUpdate(_e: Event): void {\n const percentPlayed = Math.round((100 / this.videoElement.duration) * this.videoElement.currentTime);\n const secondsPlayed = (percentPlayed / 100) * this.videoElement.duration;\n\n this.timeUpdateEvent.emit({ percent: percentPlayed, seconds: secondsPlayed });\n }\n\n private handleOnPlay(_e: Event): void {\n this.videoElement.play();\n this.playEvent.emit();\n }\n\n private handleOnPause(_e: Event): void {\n this.videoElement.pause();\n this.pauseEvent.emit();\n }\n\n @Watch(\"isPlaying\")\n handleIsPlayingChanged() {\n if (this.isPlaying) {\n this.videoElement.play();\n this.playEvent.emit();\n } else {\n this.videoElement.pause();\n this.pauseEvent.emit();\n }\n }\n\n render() {\n const sources = (\n \n this.handleError(e)} />\n {this.currentLocalization?.videoTagNotSupported}\n \n );\n const defaultProps = {\n controls: isSafari(),\n ref: (el) => (this.videoElement = el),\n onCanPlay: (e) => this.handleCanPlay(e),\n onPlay: (e) => this.handleOnPlay(e),\n onPause: (e) => this.handleOnPause(e),\n onLoadedMetaData: (e) => this.handleLoadedMetaData(e),\n onEnded: (e) => this.handleEnded(e),\n onError: (e) => this.handleError(e),\n onTimeUpdate: (e) => this.handleTimeUpdate(e),\n class: pfx({ \"fullscreen-safari\": this.isFullscreen && isSafari() })\n };\n\n const videoPlayerProps =\n this.type === VIDEOPLAYER_TYPE_FILE\n ? defaultProps\n : {\n ...defaultProps,\n src: this.resolvedSource\n };\n\n return this.autoplay ? (\n // Do NOT change the sorting order of props for the autoplay video!\n // This will break the feature in some browsers because they expect the video to be muted before setting the autoplay flag.\n \n {sources}\n \n ) : (\n // eslint-disable-next-line jsx-a11y/media-has-caption\n \n );\n }\n}\n",".#{$prefix}youtube-wrapper {\r\n iframe {\r\n height: 100%;\r\n left: 0;\r\n position: absolute;\r\n top: 0;\r\n width: 100%;\r\n &.hide-controls {\r\n pointer-events: none;\r\n position: absolute;\r\n }\r\n }\r\n}\r\n","video {\r\n display: block;\r\n height: 100%;\r\n min-width: 100%;\r\n position: relative;\r\n object-fit: cover;\r\n object-position: center center;\r\n}\r\n","import { Component, Element, Event, h, Prop, EventEmitter, Watch } from \"@stencil/core\";\nimport { VideoplayerProgressEventArgs } from \"../../constants/videoplayer-types\";\nimport { Player } from \"../player\";\nimport pfx from \"../../../../utils/style-class-prefix-helper\";\nimport { isIphoneOrIpod } from \"../../../../utils/device-helper\";\n// import { InitLogging } from \"../../../../decorators/init-logging\";\n\n@Component({\n tag: \"eon-ui-youtubeplayer\",\n styleUrls: [\"youtube-player.scss\", \"../player-shared.scss\"],\n shadow: false\n})\nexport class YouTubePlayer implements Player {\n // @InitLogging() sentryTransaction;\n\n @Element() hostElement: HTMLEonUiYoutubeplayerElement;\n player: any;\n private youtubeElement: HTMLElement;\n private isIosMobileDevice: boolean;\n\n /**\n * Raised when the browser finished analyzing the video and can start playing, meaning it has buffered enough to begin.\n * Emits the total length of the video in seconds.\n */\n @Event() canPlayEvent: EventEmitter;\n\n /**\n * Raised when the video has reached the end.\n */\n @Event() endedEvent: EventEmitter;\n\n /**\n * Raised when the video resource could not be loaded due to an error (e.g. a network error).\n */\n @Event() errorEvent: EventEmitter;\n\n /**\n * Raised when the time indicated by the currentTime attribute of the video has been updated.\n * This is triggered very frequently to keep the progress bar up2date.\n */\n @Event() timeUpdateEvent: EventEmitter;\n\n /**\n * The pauseEvent is fired when the video is paused via youtube button or customised control bar\n */\n @Event() pauseEvent: EventEmitter;\n\n /**\n * The playEvent is fired when the video is played via youtube button or customised control bar\n */\n @Event() playEvent: EventEmitter;\n\n /**\n * ID for youtube\n */\n @Prop() source: string;\n\n /**\n * Set to true if the player should attempt to autoplay the video.\n * This doesn't work on iPhones and requires the video to be muted as well.\n */\n @Prop() autoplay: boolean;\n\n /**\n * Controls whether the video is muted or not.\n */\n @Prop() isMuted: boolean;\n\n /**\n * Controls whether the video is currently playing or not.\n * Set to false to pause the video.\n */\n @Prop() isPlaying: boolean;\n\n /**\n * The seconds at which the video should play.\n */\n @Prop() seekTime: number;\n\n /**\n * Set to true to hide the control bar of the videoplayer.\n */\n @Prop() hideControls: boolean;\n\n /**\n * captions property sets Caption/Subtitles for Youtube Video\n */\n @Prop() captions: boolean = true;\n\n /**\n * Caption language Code can be set with languageCode property\n * As per ISO 639-1 two-letter language code: https://www.loc.gov/standards/iso639-2/php/code_list.php\n */\n @Prop() languageCode: string;\n\n /**\n * noCookie property will embed nocookie term into youTube video url\n * which prevent youtube from tracking user's viewing behaviour,\n * hence no activity is collected to personalise the viewing experience.\n */\n @Prop({ reflect: true }) noCookie: boolean;\n\n componentWillLoad() {\n this.isIosMobileDevice = isIphoneOrIpod();\n this.initVideo();\n }\n\n @Watch(\"hideControls\")\n handleHideControlsChanged() {\n if (this.hideControls) {\n this.player.playVideo();\n this.player.getIframe().classList.add(\"hide-controls\");\n } else {\n this.player.getIframe().classList.remove(\"hide-controls\");\n this.handleIsPlayingChanged();\n }\n }\n\n @Watch(\"isPlaying\")\n handleIsPlayingChanged() {\n if (this.isPlaying) {\n this.play();\n } else {\n this.pause();\n }\n }\n\n @Watch(\"isMuted\")\n handleIsMutedChanged() {\n if (this.isMuted) {\n this.player.mute();\n } else {\n this.player.unMute();\n }\n }\n\n @Watch(\"autoplay\")\n handleAutoplayChanged() {\n if (this.autoplay) {\n this.player.mute();\n this.player.playVideo();\n this.handleIsMutedChanged();\n }\n }\n\n @Watch(\"seekTime\")\n handleSeekTimeChanged() {\n this.player.seekTo(this.seekTime, true);\n }\n\n private handleError(_e: YT.OnErrorEvent): void {\n this.errorEvent.emit();\n }\n\n private handleStateChange(event: any) {\n switch (event.data) {\n case YT.PlayerState.PLAYING:\n this.play();\n break;\n case YT.PlayerState.PAUSED:\n this.pause();\n break;\n case YT.PlayerState.ENDED:\n this.endedEvent.emit();\n break;\n case YT.PlayerState.UNSTARTED:\n break;\n case YT.PlayerState.BUFFERING:\n break;\n }\n }\n\n /**\n * This function creates logic inside the window object to init the youtube api\n */\n private initVideo() {\n /**\n * With the Iframe Player API, you can embed a YouTube video player on your website and control the player with JavaScript.\n */\n const iframeAPIScript = document.createElement(\"script\");\n iframeAPIScript.src = \"https://www.youtube.com/iframe_api\";\n const firstScriptTag = document.getElementsByTagName(\"script\")[0];\n firstScriptTag.parentNode.insertBefore(iframeAPIScript, firstScriptTag);\n\n if (!window[\"isReady\"]) {\n window[\"isReady\"] = false;\n }\n\n if (!window[\"callbacks\"]) {\n window[\"callbacks\"] = [];\n }\n\n //this is needed to support more than one youtube player on a page\n window[\"enqueueOnYoutubeIframeAPIReady\"] = function (callback) {\n if (window[\"isReady\"]) {\n callback();\n } else {\n window[\"callbacks\"].push(callback);\n }\n };\n\n window[\"onYouTubeIframeAPIReady\"] = function () {\n window[\"isReady\"] = true;\n window[\"callbacks\"].forEach(function (callback) {\n callback();\n });\n window[\"callbacks\"].splice(0);\n };\n\n //enqueue the player of this component\n window[\"enqueueOnYoutubeIframeAPIReady\"](() => {\n this.player = new window[\"YT\"].Player(this.youtubeElement, {\n videoId: this.source,\n host: this.noCookie ? \"http://www.youtube-nocookie.com\" : \"http://www.youtube.com\",\n playerVars: {\n cc_load_policy: this.captions ? 1 : 0,\n cc_lang_pref: this.languageCode,\n autoplay: this.autoplay ? 1 : 0,\n modestbranding: 1,\n controls: 0,\n disablekb: 1,\n rel: 0,\n showinfo: 0,\n fs: 0,\n iv_load_policy: 3,\n playsinline: 0,\n // origin: \"http://localhost:9001\",\n loop: this.autoplay ? 1 : 0\n },\n events: {\n onReady: (e) => {\n this.handleCanPlay(e);\n if (this.isIosMobileDevice) {\n this.player.cueVideoById(this.source);\n }\n },\n onError: (e) => {\n this.handleError(e);\n },\n onStateChange: (e) => {\n this.handleStateChange(e);\n this.handleApiChange(e);\n }\n }\n });\n });\n }\n\n handleApiChange(_e) {\n this.player.loadModule(\"captions\");\n this.player.getOption(\"captions\", \"track\");\n }\n\n private handleCanPlay(_e: YT.PlayerEvent): void {\n this.canPlayEvent.emit(this.player.getDuration());\n let time_update_interval;\n // Clear any old interval.\n clearInterval(time_update_interval);\n\n // Start interval to update elapsed time display and\n // the elapsed part of the progress bar every second.\n time_update_interval = setInterval(() => {\n const percentPlayed = Math.round((100 / this.player.getDuration()) * this.player.getCurrentTime());\n const secondsPlayed = (percentPlayed / 100) * this.player.getDuration();\n\n this.timeUpdateEvent.emit({ percent: percentPlayed, seconds: secondsPlayed });\n }, 250);\n\n // Autoplay should work as soon as video loads on any site\n this.handleAutoplayChanged();\n }\n\n private play() {\n this.player.playVideo();\n this.playEvent.emit();\n this.handleAutoplayChanged();\n }\n\n private pause() {\n this.player.pauseVideo();\n this.pauseEvent.emit();\n }\n\n render() {\n return (\n
\n
(this.youtubeElement = el)}>
\n
\n );\n }\n}\n"],"mappings":"8WAAA,MAAMA,EAAc,q36CACpB,MAAAC,EAAeD,E,MCYFE,EAAmB,M,geAsE9B,UAAAC,CAAWC,GACT,MAAMC,QAAEA,EAAOC,cAAEA,GAAkBF,EACnC,MAAMG,KAAEA,EAAIC,MAAEA,GAAWF,EAA0BG,wBACnD,MAAMC,GAAgBL,EAAUE,GAAQC,EAAS,IACjD,MAAMG,EAAcD,EAAc,IAAOE,KAAKC,SAE9CD,KAAK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