

<script> document.addEventListener('DOMContentLoaded', function() {
    // Replace WordPress video with VideoJS
    const wpVideos = document.querySelectorAll('.wp-video-shortcode');
    
    wpVideos.forEach(function(wpVideo, index) {
        // Get the video source
        const originalSrc = wpVideo.querySelector('source').getAttribute('src');
        
        // Create a container for the new player
        const container = document.createElement('div');
        container.className = 'video-js-container';
        wpVideo.parentNode.insertBefore(container, wpVideo);
        
        // Create the video element
        const videoHTML = `
            <video id="my-controlled-video-${index}" class="video-js vjs-default-skin" controls>
                <source src="${originalSrc}" type="video/mp4">
            </video>
        `;
        container.innerHTML = videoHTML;
        
        // Remove the original video
        wpVideo.parentNode.removeChild(wpVideo);
        
        // Initialize VideoJS with custom controls
        const player = videojs(`my-controlled-video-${index}`, {
            controls: true,
            autoplay: true,
            preload: 'auto'
        });
        
        let videoStartTime = 0;
        let lastKnownTime = 0;
        let isPlaying = false;
        
        // Start tracking time when video plays
        player.on('play', function() {
            isPlaying = true;
            if (videoStartTime === 0) {
                videoStartTime = Date.now() / 1000 - player.currentTime();
            }
        });
        
        player.on('pause', function() {
            isPlaying = false;
            lastKnownTime = player.currentTime();
        });
        
        // Check for skipping ahead
        player.on('timeupdate', function() {
            if (isPlaying) {
                const currentTime = player.currentTime();
                const expectedTime = (Date.now() / 1000) - videoStartTime;
                
                // Allow 5 seconds of tolerance (for buffering, etc)
                if (currentTime > expectedTime + 1) {
                    console.log('Attempt to skip ahead detected');
                    player.currentTime(lastKnownTime + 0.5);
                    // Optional: display message
                    alert('Please watch the entire video without skipping ahead');
                }
                
                lastKnownTime = player.currentTime();
            }
        });
        
        // Mark completion when video ends
        player.on('ended', function() {
            // You can trigger LearnPress completion here
            console.log('Video completed');
            // Example: document.querySelector('.lp-course-complete-button').disabled = false;
        });
    });
});</script>


<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="https://www.academy.ideology.space/wp-sitemap-index.xsl" ?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><sitemap><loc>https://www.academy.ideology.space/wp-sitemap-posts-post-1.xml</loc></sitemap><sitemap><loc>https://www.academy.ideology.space/wp-sitemap-posts-page-1.xml</loc></sitemap><sitemap><loc>https://www.academy.ideology.space/wp-sitemap-posts-lp_course-1.xml</loc></sitemap><sitemap><loc>https://www.academy.ideology.space/wp-sitemap-taxonomies-category-1.xml</loc></sitemap><sitemap><loc>https://www.academy.ideology.space/wp-sitemap-users-1.xml</loc></sitemap></sitemapindex>
