<?php  
/**
*
* @package Luzuk Premium
*/
if(get_theme_mod('luzuk_premium_about_video_box_disable') != 'on' ){?>
<section id="ourvideo-section" class="ht-section">	
	<div class="container-fluid pd-0">
		<?php
			$showStatic = true;
			for( $i = 1; $i < 4; $i++ ){

				$url = get_theme_mod('luzuk_about_video_url_'.$i, '#');

				$luzuk_about_video_page_id = get_theme_mod('luzuk_about_video_page_icon'.$i); 
				if(!empty($luzuk_about_video_page_id)){
					$showStatic = false;
					break;
				}
			}
			$luzuk_about_video_page_id = get_theme_mod('luzuk_about_video_page');
		?>
		<div class="video-content-bg" > 
			<div class="v-oly"></div>
			<?php	
				$iframe = get_theme_mod('luzuk_about_video_box_embade', 'Add your video embed code in customizer');
			?>
			<!-- </?php if( get_theme_mod('aboutvideoiframe_button_display','show' ) == 'show') :?>								 -->
			<div class="video-box">
				<div class="videos-icon">
					<a class="trigger_popup_fricc popup-video"><i class="fa fa-play"></i></a>
				</div>
			</div>
			<div class="hover_bkgr_fricc">
				<span class="helper"></span>
			    <div>
			        <div class="popupCloseButton">X</div>
			        <?php echo $iframe; ?>
			    </div>
			</div>
			<!-- </?php endif ?> -->
			<div class="clearfix"></div>
		</div>	
	</div> 
</section>
<script>
document.addEventListener("DOMContentLoaded", function () {
    const iframe = document.querySelector('.hover_bkgr_fricc iframe');

    if (iframe) {
        let src = iframe.getAttribute('src') || '';

        // Avoid duplicate autoplay/mute
        if (!src.includes('autoplay=1')) {
            const separator = src.includes('?') ? '&' : '?';

            if (src.includes('youtube.com')) {
                src += `${separator}autoplay=1&mute=1&rel=0`;
            } else if (src.includes('vimeo.com')) {
                src += `${separator}autoplay=1&muted=1`;
            }

            iframe.setAttribute('src', src);
        }

        // OPTIONAL: Show the video (if it was hidden in a popup)
        document.querySelector('.hover_bkgr_fricc').style.display = 'block';
    }
});
</script>


<?php }


