<!DOCTYPE html>
<html>

<head>
    <title>CRICSPORTCENTRAL WILLOWHD-</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">
    <!-- Using Shaka Player 4.7.6 -->
    <script src="https://cdnjs.cloudflare.com/ajax/libs/shaka-player/4.7.6/shaka-player.ui.min.js" crossorigin="anonymous"></script>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/shaka-player/4.7.6/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://upload.wikimedia.org/wikipedia/en/thumb/7/7e/Cricbuzz_Logo.svg/440px-Cricbuzz_Logo.svg.png" 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>
        // Ask user to join the Telegram channel
        if (confirm("Join Our Telegram Channel @CRICSPORTCENTRAL")) {
            window.location.href = "https://t.me/CRICSPORTCENTRAL";
        }

        // Initialize the Shaka Player
        async function init() {
            const video = document.getElementById("video");
            const ui = video.ui;
            const controls = ui.getControls();
            const player = controls.getPlayer();

            // Store player and UI globally for debugging
            window.player = player;
            window.ui = ui;

            // Set the ClearKey for DRM configuration
            const clearKeys = {
                '77889c7295e1f113852aa6030242b8e4': "ec8c522d46888a15ff6533aa28ccd7f5"
            };

            // Apply the ClearKey to the player
            player.configure({
                drm: {
                    clearKeys: clearKeys
                }
            });

            // Add event listeners for error handling
            player.addEventListener("error", onPlayerErrorEvent);
            controls.addEventListener("error", onUIErrorEvent);

            // Try to load the HLS stream
            try {
                await player.load("https://uselector.cdn.intigral-ott.net/CRL2/CRL2.isml/manifest.mpd");
                console.log("The video has now been loaded!");
            } catch (error) {
                onPlayerError(error);
            }
        }

        // Error event handler for player
        function onPlayerErrorEvent(event) {
            onPlayerError(event.detail);
        }

        // Error handling function
        function onPlayerError(error) {
            console.error("Error code", error.code, "object", error);
        }

        // Error event handler for UI
        function onUIErrorEvent(event) {
            onPlayerError(event.detail);
        }

        // Initialization failed handler
        function initFailed(error) {
            console.error("Unable to load the UI library!");
        }

        // Listen for the Shaka Player UI load success or failure
        document.addEventListener("shaka-ui-loaded", init);
        document.addEventListener("shaka-ui-load-failed", initFailed);
    </script>
</body>

</html>