<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>BD STREAMS TV</title>
    <meta name="referrer" content="no-referrer">
    <script src="http://content.jwplatform.com/libraries/SAHhwvZq.js"></script>
    <style>
        a {
            display: block;
            font-size: 16px;
            font-weight: 500;
            text-align: center;
            border-radius: 8px;
            padding: 5px;
            background: #389ce9;
            text-decoration: none;
            color: #fff;
        }

        svg {
            width: 30px;
            height: 50px;
            vertical-align: middle;
            margin: 0px 5px;
        }
    </style>
</head>
<body onload="init()">

<!-- Prevent Right-Click Context Menu on Images -->
<script>
    document.addEventListener("DOMContentLoaded", function () {
        document.querySelectorAll("img").forEach(function (img) {
            img.addEventListener("contextmenu", function (event) {
                event.preventDefault();
            });
        });
    });
</script>

<div id="jwPlayer"></div>
<div id="jwplayers"></div>
<iframe id="iframe" style="display:none;"></iframe>

<script>
    // Function to extract URL parameters
    function getParam(paramName) {
        const params = new URLSearchParams(window.location.search);
        return params.get(paramName);
    }

    // Main Logic
    const srcParam = getParam("src");
    const url = getParam("url");  // Extract the 'url' parameter
    const id = getParam("id");    // Extract the 'id' parameter

    if (srcParam) {
        // Show iframe if src is available
        document.getElementById('iframe').src = srcParam;
        document.getElementById('iframe').style.display = 'block';
        document.getElementById('jwPlayer').style.display = 'none';
    } else if (url) {
        // Initialize JW Player with URL
        jwplayer("jwPlayer").setup({
            file: url
        });
        document.getElementById('iframe').style.display = 'none';
    } else if (id) {
        // Construct HLS URL dynamically and initialize JW Player
        const hlsUrl = https://play1nm.hnyongshun.cn/live/ballbar_${id}.m3u8?bdstreams.bio.link;
        jwplayer("jwPlayer").setup({
            file: hlsUrl
        });
        document.getElementById('iframe').style.display = 'none';
    }
</script>

<!-- Telegram Join Link -->
<a href="https://t.me/+KP7vLC3PebE1NmE1" target="_blank">
    <svg viewBox="0 0 21 18">
        <g fill="none">
            <path fill="#ffffff" d="M0.554,7.092 L19.117,0.078 C19.737,-0.156 20.429,0.156 20.663,0.776 C20.745,0.994 20.763,1.23 20.713,1.457 L17.513,16.059 C17.351,16.799 16.62,17.268 15.88,17.105 C15.696,17.065 15.523,16.987 15.37,16.877 L8.997,12.271 C8.614,11.994 8.527,11.458 8.805,11.074 C8.835,11.033 8.869,10.994 8.905,10.958 L15.458,4.661 C15.594,4.53 15.598,4.313 15.467,4.176 C15.354,4.059 15.174,4.037 15.036,4.125 L6.104,9.795 C5.575,10.131 4.922,10.207 4.329,10.002 L0.577,8.704 C0.13,8.55 -0.107,8.061 0.047,7.614 C0.131,7.374 0.316,7.182 0.554,7.092 Z"></path>
        </g>
    </svg>
    JOIN US ON TELEGRAM
</a>

<!-- WhatsApp Join Link -->
<div style="border: 1px solid teal; border-radius: 2px; background: black; display: flex; align-items: center; padding: 7px; justify-content: space-between;"> 
    <span style="display: flex; align-items: center;">
        <i class="fa fa-whatsapp" style="font-size:24px;color:black;"></i> 
        <span style="font-weight: bold; margin-left: 10px; font-size: 0.9rem !important;">WhatsApp Channel </span> 
    </span> 
    <a href="https://whatsapp.com/channel/0029Vad7Rh4BPzjX1J6x6M3J" rel="nofollow noopener noreferrer" style="text-decoration: none; background: #25d366; color: #242424; padding: 5px 10px; border-radius: 2px;" target="_blank"> 
        Join Now 
    </a>
</div>

</body>
</html>