/******/ (function() { // webpackBootstrap var __webpack_exports__ = {}; /*!*******************************************!*\ !*** ./src/js/modulewise/video-slider.js ***! \*******************************************/ (function ($) { 'use strict'; $(document).ready(function () { var players3 = {}; window.onVidyardAPI = vidyardEmbed => { vidyardEmbed.api.addReadyListener((_, player) => { const uuid = player.uuid; players3[uuid] = player; // console.log(players); }); }; jQuery('.video-carousel-v2 .video-carousel-v2__slider').each(function () { // check has slick class if ($(this).hasClass('slick-initialized')) { return; } const showArrows = $(this).data('show-arrows'); const showDots = $(this).data('show-dots'); // Store all player instances // const players2 = {}; // Initialize slick slider const $slider = jQuery(this).slick({ slidesToShow: 1, slidesToScroll: 1, arrows: showArrows, dots: showDots, infinite: false, // Prevent auto sliding when video is playing autoplay: false }); // slider on ready $slider.on('init', function (event, slick) { // Play video on current slide const $currentSlideElement = $(slick.$slides[0]); const currentUuid = $currentSlideElement.data('uuid'); if (players3[currentUuid]) { players3[currentUuid].on('playerComplete', () => { // Move to next slide when video ends const currentSlide = $slider.slick('slickCurrentSlide'); const totalSlides = $slider.slick('getSlick').slideCount; if (currentSlide === totalSlides - 1) { // If current slide is the last slide, go to the first slide $slider.slick('slickGoTo', 0); } else { // Otherwise, go to the next slide $slider.slick('slickNext'); } }); } }); // Handle slide changes $slider.on('beforeChange', function (event, slick, currentSlide, nextSlide) { // Pause video on current slide const $currentSlideElement = $(slick.$slides[currentSlide]); const currentUuid = $currentSlideElement.data('uuid'); if (players3[currentUuid]) { players3[currentUuid].pause(); } }); // $slider.on('afterChange', function(event, slick, currentSlide) { // // Play video on new current slide // const $currentSlideElement = $(slick.$slides[currentSlide]); // const currentUuid = $currentSlideElement.data('uuid'); // if (players3[currentUuid]) { // players3[currentUuid].play(); // } // }); }); jQuery('.video-carousel .video-carousel__slider').each(function () { // check has slick class if ($(this).hasClass('slick-initialized')) { return; } const showArrows = $(this).data('show-arrows'); const showDots = $(this).data('show-dots'); // Add aria-live region to the slider. setTimeout(function () { $('.video-carousel__slider .slick-track').attr('aria-live', 'polite'); $('.video-carousel__slider.slick-initialized .slick-prev').removeAttr('tabindex'); $('.video-carousel__slider.slick-initialized .slick-next').removeAttr('tabindex'); }, 1000); // Initialize slick slider const $slider = jQuery(this).slick({ slidesToShow: 1, slidesToScroll: 1, arrows: showArrows, dots: showDots, infinite: false, // Prevent auto sliding when video is playing autoplay: false }); // Add aria-live region to the slider. $slider.on('init afterChange', function () { $('.slick-arrow').each(function () { const disabled = $(this).attr('aria-disabled') === 'true'; $(this).attr('tabindex', disabled ? '-1' : '0'); }); }); $slider.on('init', function (event, slick) { $('.video-carousel__slider.slick-initialized .slick-prev').attr('aria-label', 'Previous slide'); $('.video-carousel__slider.slick-initialized .slick-next').attr('aria-label', 'Next slide'); }); $slider.on('afterChange', function (event, slick, currentSlide) { const $slide = $(slick.$slides[currentSlide]); $slide.attr('aria-hidden', 'false').siblings().attr('aria-hidden', 'true'); }); // // Handle slide changes $slider.on('beforeChange', function (event, slick, currentSlide, nextSlide) { // Pause video on current slide const $currentSlideElement = $(slick.$slides[currentSlide]); const currentUuid = $currentSlideElement.data('uuid'); console.log(players3[currentUuid]); if (players3[currentUuid]) { players3[currentUuid].pause(); } }); // $slider.on('afterChange', function(event, slick, currentSlide) { // // Play video on new current slide // const $currentSlideElement = $(slick.$slides[currentSlide]); // const currentUuid = $currentSlideElement.data('uuid'); // if (players[currentUuid]) { // players[currentUuid].play(); // } // }); // iframe-play-btn click event jQuery(document).on('click', '.iframe-play-btn', function (e) { e.preventDefault(); // Get the UUID for the Vidyard video from the data attribute const uuid = jQuery(this).data('uuid'); // Remove any existing popup to avoid duplicates jQuery('#vidyardPopup').remove(); // Generate the popup HTML structure const popupHTML = ` `; // Append the popup to the body jQuery('body').append(popupHTML); // Display the popup jQuery('#vidyardPopup').fadeIn(); // Initialize the Vidyard player and play the video VidyardV4.api.addReadyListener(function (player) { const players = VidyardV4.api.getPlayersByUUID(uuid); if (players.length > 0) { players[0].play(); } }); }); // Close the popup and pause the video jQuery(document).on('click', '.close-button', function () { // Hide the popup jQuery('#vidyardPopup').fadeOut(function () { // Remove the popup from the DOM after hiding jQuery(this).remove(); }); // Pause the video const players = VidyardV4.api.getPlayers(); if (players.length > 0) { players[0].pause(); } }); }); }); })(jQuery); /******/ })() ; //# sourceMappingURL=videoslider.js.map; !function(i){"use strict";"function"==typeof define&&define.amd?define(["jquery"],i):"undefined"!=typeof exports?module.exports=i(require("jquery")):i(jQuery)}(function(i){"use strict";var e=window.Slick||{};(e=function(){var e=0;return function(t,o){var s,n=this;n.defaults={accessibility:!0,adaptiveHeight:!1,appendArrows:i(t),appendDots:i(t),arrows:!0,asNavFor:null,prevArrow:'',nextArrow:'',autoplay:!1,autoplaySpeed:3e3,centerMode:!1,centerPadding:"0",cssEase:"ease",customPaging:function(e,t){return i('