<!DOCTYPE html>
<html lang="en">
<head>
    <title>JW Player By SHIHAB TV</title>
    <link rel="stylesheet" type="text/css" href="https://shiki.tv-shihab.xyz/all/jw.css">
    <link rel="stylesheet" type="text/css" href="style.css">
    <script src="https://cdn.jwplayer.com/libraries/IDzF9Zmk.js"></script>
    <script>jwplayer.key = "64HPbvSQorQcd52B8XFuhMtEoitbvY/EXJmMBfKcXZQU2Rnn";</script>
</head>
<body>
    <div id="myElement"></div>

    <script type="text/javascript">
        jwplayer("myElement").setup({
            width: '100%',
            height: '100%',
            autostart: true,
            fullscreen: true,
            controls: true,
            pipIcon: "enabled",
            volume: 50,
            mute: false,
            preload: "auto",
            file: "tsports.php?id=<?php echo $id ?>",
            aspectratio: "16:9",
            stretching: "exactfit",
            aboutlink: "/#",
            logo: {
                file: "https://tv-shihab.xyz/wp-content/uploads/2024/03/tv-shihab-logo-w.png",
                margin: "15px",
                position: "top-right",
                link: "https://tv-shihab.xyz/"
            },
            captions: {
                color: '#ffb800',
                fontSize: 30,
                backgroundOpacity: 0
            },
            type: "hls",
            primary: "html5",
            hlshtml: true,
        });
    </script>

    <script>
        setTimeout(() => {
            document.getElementById('loading')?.style.display = 'none';
        }, 3000);
        
// created by SHIHAB TV, | https://t.me/tvshihab
        
        document.addEventListener("DOMContentLoaded", () => {
            const videoElement = document.querySelector("video");
            if (!videoElement) return;

            const videoSource = videoElement.querySelector("source")?.src;
            if (!videoSource) return;

            if (Hls.isSupported()) {
                const hls = new Hls({
                    maxMaxBufferLength: 100,
                });
                hls.loadSource(videoSource);
                hls.attachMedia(videoElement);
                hls.on(Hls.Events.MANIFEST_PARSED, () => {
                    const qualityLevels = hls.levels.map(level => level.height);
                    new Plyr(videoElement, {
                        quality: {
                            default: qualityLevels[0],
                            options: qualityLevels,
                            forced: true,
                            onChange: (quality) => {
                                hls.levels.forEach((level, index) => {
                                    if (level.height === quality) {
                                        hls.currentLevel = index;
                                    }
                                });
                            }
                        }
                    });
                });
                window.hls = hls;
            } else if (videoElement.canPlayType('application/vnd.apple.mpegurl')) {
        
                new Plyr(videoElement);
            }
        });
    </script>
</body>
</html>