PluginProbe
Elementor Website Builder – more than just a page builder / 3.30.0-beta1
Elementor Website Builder – more than just a page builder v3.30.0-beta1
4.3.4 4.3.3 4.3.2 4.3.1 4.3.0 4.3.0-beta3 4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 All 457 releases
elementor / assets / js / video.d862fafddbe5d05459f3.bundle.js

video.d862fafddbe5d05459f3.bundle.js in Elementor Website Builder – more than just a page builder 3.30.0-beta1, at assets/js/video.d862fafddbe5d05459f3.bundle.js

186 lines 6.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /*! elementor - v3.30.0 - 10-06-2025 */
2 "use strict";
3 (self["webpackChunkelementorFrontend"] = self["webpackChunkelementorFrontend"] || []).push([["video"],{
4
5 /***/ "../assets/dev/js/frontend/handlers/video.js":
6 /*!***************************************************!*\
7 !*** ../assets/dev/js/frontend/handlers/video.js ***!
8 \***************************************************/
9 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
10
11
12
13 Object.defineProperty(exports, "__esModule", ({
14 value: true
15 }));
16 exports["default"] = void 0;
17 __webpack_require__(/*! core-js/modules/es.array.includes.js */ "../node_modules/core-js/modules/es.array.includes.js");
18 __webpack_require__(/*! core-js/modules/esnext.iterator.constructor.js */ "../node_modules/core-js/modules/esnext.iterator.constructor.js");
19 __webpack_require__(/*! core-js/modules/esnext.iterator.find.js */ "../node_modules/core-js/modules/esnext.iterator.find.js");
20 class Video extends elementorModules.frontend.handlers.Base {
21 getDefaultSettings() {
22 return {
23 selectors: {
24 imageOverlay: '.elementor-custom-embed-image-overlay',
25 video: '.elementor-video',
26 videoIframe: '.elementor-video-iframe',
27 playIcon: '.elementor-custom-embed-play'
28 }
29 };
30 }
31 getDefaultElements() {
32 const selectors = this.getSettings('selectors');
33 return {
34 $imageOverlay: this.$element.find(selectors.imageOverlay),
35 $video: this.$element.find(selectors.video),
36 $videoIframe: this.$element.find(selectors.videoIframe),
37 $playIcon: this.$element.find(selectors.playIcon)
38 };
39 }
40 handleVideo() {
41 if (this.getElementSettings('lightbox')) {
42 return;
43 }
44 if ('youtube' === this.getElementSettings('video_type')) {
45 this.apiProvider.onApiReady(apiObject => {
46 this.elements.$imageOverlay.remove();
47 this.prepareYTVideo(apiObject, true);
48 });
49 } else {
50 this.elements.$imageOverlay.remove();
51 this.playVideo();
52 }
53 }
54 playVideo() {
55 if (this.elements.$video.length) {
56 // This.youtubePlayer exists only for YouTube videos, and its play function is different.
57 if (this.youtubePlayer) {
58 this.youtubePlayer.playVideo();
59 } else {
60 this.elements.$video[0].play();
61 }
62 return;
63 }
64 const $videoIframe = this.elements.$videoIframe,
65 lazyLoad = $videoIframe.data('lazy-load');
66 if (lazyLoad) {
67 $videoIframe.attr('src', lazyLoad);
68 }
69 if (this.getElementSettings('autoplay')) {
70 $videoIframe.attr('allow', 'autoplay');
71 $videoIframe[0].src = this.apiProvider.getAutoplayURL($videoIframe[0].src);
72 }
73 }
74 async animateVideo() {
75 const lightbox = await elementorFrontend.utils.lightbox;
76 lightbox.setEntranceAnimation(this.getCurrentDeviceSetting('lightbox_content_animation'));
77 }
78 async hideLightbox() {
79 const lightbox = await elementorFrontend.utils.lightbox;
80 lightbox.getModal().hide();
81 }
82 prepareYTVideo(YT, onOverlayClick) {
83 const elementSettings = this.getElementSettings(),
84 playerOptions = {
85 videoId: this.videoID,
86 events: {
87 onReady: () => {
88 if (elementSettings.mute) {
89 this.youtubePlayer.mute();
90 }
91 if (elementSettings.autoplay || onOverlayClick) {
92 this.youtubePlayer.playVideo();
93 }
94 },
95 onStateChange: event => {
96 if (event.data === YT.PlayerState.ENDED && elementSettings.loop) {
97 this.youtubePlayer.seekTo(elementSettings.start || 0);
98 }
99 }
100 },
101 playerVars: {
102 controls: elementSettings.controls ? 1 : 0,
103 rel: elementSettings.rel ? 1 : 0,
104 playsinline: elementSettings.play_on_mobile ? 1 : 0,
105 cc_load_policy: elementSettings.cc_load_policy ? 1 : 0,
106 autoplay: elementSettings.autoplay ? 1 : 0,
107 start: elementSettings.start,
108 end: elementSettings.end
109 }
110 };
111
112 // To handle CORS issues, when the default host is changed, the origin parameter has to be set.
113 if (elementSettings.yt_privacy) {
114 playerOptions.host = 'https://www.youtube-nocookie.com';
115 playerOptions.origin = window.location.hostname;
116 }
117 this.youtubePlayer = new YT.Player(this.elements.$video[0], playerOptions);
118 }
119 bindEvents() {
120 this.elements.$imageOverlay.on('click', this.handleVideo.bind(this));
121 this.elements.$playIcon.on('keydown', event => {
122 const playKeys = [13,
123 // Enter key.
124 32 // Space bar key.
125 ];
126 if (playKeys.includes(event.keyCode)) {
127 this.handleVideo();
128 }
129 });
130 }
131 onInit() {
132 super.onInit();
133 const elementSettings = this.getElementSettings();
134 if (elementorFrontend.utils[elementSettings.video_type]) {
135 this.apiProvider = elementorFrontend.utils[elementSettings.video_type];
136 } else {
137 this.apiProvider = elementorFrontend.utils.baseVideoLoader;
138 }
139 if ('youtube' !== elementSettings.video_type) {
140 // Currently the only API integration in the Video widget is for the YT API
141 return;
142 }
143 this.videoID = this.apiProvider.getVideoIDFromURL(elementSettings.youtube_url);
144
145 // If there is an image overlay, the YouTube video prep method will be triggered on click
146 if (!this.videoID) {
147 return;
148 }
149
150 // If the user is using an image overlay, loading the API happens on overlay click instead of on init.
151 if (elementSettings.show_image_overlay && elementSettings.image_overlay.url) {
152 return;
153 }
154 if (elementSettings.lazy_load) {
155 this.intersectionObserver = elementorModules.utils.Scroll.scrollObserver({
156 callback: event => {
157 if (event.isInViewport) {
158 this.intersectionObserver.unobserve(this.elements.$video.parent()[0]);
159 this.apiProvider.onApiReady(apiObject => this.prepareYTVideo(apiObject));
160 }
161 }
162 });
163
164 // We observe the parent, since the video container has a height of 0.
165 this.intersectionObserver.observe(this.elements.$video.parent()[0]);
166 return;
167 }
168 this.apiProvider.onApiReady(apiObject => this.prepareYTVideo(apiObject));
169 }
170 onElementChange(propertyName) {
171 if (0 === propertyName.indexOf('lightbox_content_animation')) {
172 this.animateVideo();
173 return;
174 }
175 const isLightBoxEnabled = this.getElementSettings('lightbox');
176 if ('lightbox' === propertyName && !isLightBoxEnabled) {
177 this.hideLightbox();
178 }
179 }
180 }
181 exports["default"] = Video;
182
183 /***/ })
184
185 }]);
186 //# sourceMappingURL=video.d862fafddbe5d05459f3.bundle.js.map