<!DOCTYPE html>
<html>

<head>
    <title>CRICSPORTCENTRAL TNT 4-</title>
    <link rel="icon" href="https://upload.wikimedia.org/wikipedia/commons/thumb/8/82/Telegram_logo.svg/2048px-Telegram_logo.svg.png" type="image/png" sizes="250x250">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script src="https://cdnjs.cloudflare.com/ajax/libs/shaka-player/4.1.1/shaka-player.ui.min.js" crossorigin="anonymous"></script>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/shaka-player/4.1.1/controls.min.css" crossorigin="anonymous">
    <style>
        /* Overflow menu style */
        .shaka-overflow-menu {
            background-color: rgb(41, 41, 163);
            color: rgb(153, 153, 153);
        }

        .shaka-overflow-menu button:hover {
            background-color: rgb(45, 45, 45);
        }

        .shaka-overflow-button-label {
            color: rgb(245, 245, 245);
        }

        .shaka-current-selection-span {
            color: rgb(202, 202, 202);
        }

        .material-icons-round {
            color: rgb(230, 230, 230);
        }

        /* Overflow sub menu style */
        .shaka-settings-menu {
            background-color: rgb(35, 35, 35);
            color: rgb(255, 255, 255);
        }

        .shaka-settings-menu button {
            color: rgb(255, 255, 255);
        }

        .shaka-settings-menu button:hover {
            background-color: rgb(45, 45, 45);
        }

        /* Watermark styling */
        .watermark {
            position: absolute;
            top: 1px; /* Moved closer to the top */
            left: 10px;
            width: 80px; /* Reduced size */
            opacity: 0.7;
            z-index: 999;
        }
    </style>
</head>

<body bgcolor="black" style="margin:0">
    <div data-shaka-player-container style="position:absolute;top:0;left:0;width:100%;height:100%;object-fit:cover">
        <video autoplay muted data-shaka-player id="video" poster="https://www.newscaststudio.com/wp-content/uploads/2023/07/tnt-sports-uk-branding-768x434.jpg" style="width:100%;height:100%"></video>
        <img src="https://i.postimg.cc/MKQtVKfF/Picsart-24-12-10-14-13-36-288.png" alt="Watermark" class="watermark">
    </div>

    <script>
        if (confirm("Join Our Telegram Channel @CRICSPORTCENTRAL")) {
            window.location.href = "https://t.me/CRICSPORTCENTRAL";
        }

        async function init() {
            const videoElement = document.getElementById("video");
            const ui = videoElement.ui;
            const controls = ui.getControls();
            const player = controls.getPlayer();

            window.player = player;
            window.ui = ui;

            // Set DRM configuration with new MPD URL and clear key
            player.configure({
                drm: {
                    clearKeys: {
                        'e31a5a81caff5d07ea2411a571fc2e59': "96c5ef69479732ae734f962748c19729"
                    }
                }
            });

            // Set default playback speed to 1x
            videoElement.playbackRate = 1;

            // Add fast forward and rewind logic
            videoElement.addEventListener("dblclick", (event) => {
                const rect = videoElement.getBoundingClientRect();
                const x = event.clientX - rect.left;

                if (x < rect.width / 2) {
                    // Left side double-tap: rewind 10 seconds
                    videoElement.currentTime = Math.max(0, videoElement.currentTime - 10);
                } else {
                    // Right side double-tap: fast forward 10 seconds
                    videoElement.currentTime = Math.min(
                        videoElement.duration,
                        videoElement.currentTime + 10
                    );
                }
            });

            // Load the new video URL
            try {
                await player.load("https://ottb.live.cf.ww.aiv-cdn.net/lhr-nitro/live/clients/dash/enc/i2pcjr4pe5/out/v1/912e9db56d75403b8a9ac0a719110f36/cenc.mpd");
                console.log("The video has now been loaded!");
            } catch (error) {
                console.error("Error loading video:", error);
            }
        }

        // Error handlers
        function onPlayerErrorEvent(event) {
            console.error("Player error:", event.detail);
        }

        function onUIErrorEvent(event) {
            console.error("UI error:", event.detail);
        }

        // Initialize Shaka Player
        document.addEventListener("shaka-ui-loaded", init);
        document.addEventListener("shaka-ui-load-failed", () => {
            console.error("Unable to load the UI library!");
        });
    </script>
</body>

</html>