Sindbad~EG File Manager

Current Path : /home/u625735752/domains/floralwhite-woodpecker-723030.hostingersite.com/public_html/1.11/
Upload File :
Current File : /home/u625735752/domains/floralwhite-woodpecker-723030.hostingersite.com/public_html/1.11/live.php

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Jam On - Live Player</title>
    
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.2/css/all.min.css" integrity="sha512-SnH5WK+bZxgPHs44uWIX+LLJAJ9/2PkPKZ5QiAj6Ta86w+fsb2TkcmfRyVX3pBnMFcV7oQPJkl9QevSCWr3W6A==" crossorigin="anonymous" referrerpolicy="no-referrer" />

    <style>
        /* --- Basic Setup --- */
        body {
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
            background-color: #111;
            color: #fff;
            margin: 0;
            overflow: hidden;
            height: 100vh;
            display: flex;
            align-items: center;
            justify-content: center;
            -webkit-app-region: drag; /* Allows dragging the window */
        }
        button, input {
            -webkit-app-region: no-drag; /* Prevents controls from dragging */
        }

        /* --- Player Container (from your css5.css) --- */
        .live-player-container {
            background: rgba(255, 255, 255, 0.05);
            backdrop-filter: blur(10px);
            border-radius: 12px;
            padding: 15px 20px;
            width: 100%;
            max-width: 420px;
            box-sizing: border-box; /* Ensures padding is included in width */
            border: 1px solid rgba(255, 255, 255, 0.1);
        }

        /* --- Time Bar --- */
        #timeBar {
            width: 100%;
            -webkit-appearance: none;
            appearance: none;
            height: 3px;
            background: rgba(255, 255, 255, 0.2);
            outline: none;
            margin-bottom: 10px;
        }
        #timeBar::-webkit-slider-thumb {
            -webkit-appearance: none;
            appearance: none;
            width: 10px;
            height: 10px;
            background: #fff;
            border-radius: 50%;
            cursor: pointer;
        }

        /* --- Bottom Controls --- */
        .bottom-controls {
            display: flex;
            align-items: center;
            justify-content: space-between;
        }
        .left-controls {
            display: flex;
            align-items: center;
            gap: 10px;
        }

        /* --- Play/Mute Buttons --- */
        #playPauseBtn, #muteBtn {
            background: rgba(255, 255, 255, 0.1);
            border: none;
            color: #fff;
            width: 35px;
            height: 35px;
            border-radius: 50%;
            font-size: 14px;
            cursor: pointer;
            transition: background 0.2s ease;
        }
        #playPauseBtn:hover, #muteBtn:hover {
            background: rgba(255, 255, 255, 0.2);
        }

        /* --- Time & Track Info --- */
        #currentTime {
            font-size: 13px;
            color: #ccc;
            padding-left: 5px;
        }
        .now-playing-info {
            font-size: 13px;
            padding-left: 8px;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }
        .now-playing-info strong {
            color: #fff;
        }
        .now-playing-info em {
            color: #ccc;
            font-style: normal;
        }

        /* --- Volume Slider --- */
        #volumeSlider {
            -webkit-appearance: none;
            appearance: none;
            width: 80px; /* Horizontal slider */
            height: 3px;
            background: rgba(255, 255, 255, 0.2);
            outline: none;
            cursor: pointer;
        }
        #volumeSlider::-webkit-slider-thumb {
            -webkit-appearance: none;
            appearance: none;
            width: 12px;
            height: 12px;
            background: #fff;
            border-radius: 50%;
        }
        
    </style>
</head>
<body>

    <div class="live-player-container transparent-player" id="livePlayer">
        <audio id="liveAudio" autoplay="">
            <source src="https://jam-on.ice.infomaniak.ch/jam-on-128.mp3" type="audio/mpeg">
            Your browser does not support the audio element.
        </audio>

        <input type="range" id="timeBar" min="0" max="100" value="0" step="1" disabled="">

        <div class="bottom-controls d-flex align-items:center justify-content-between">
            <div class="left-controls d-flex align-items-center gap-2">
                <button id="playPauseBtn"><i class="fas fa-play"></i></button>
                <button id="muteBtn"><i class="fas fa-volume-up"></i></button>
                <span id="currentTime" style="padding-left: 10px;">00:00</span>
                <div class="now-playing-info" style="font-size: 13px; padding-left: 8px;">
                    <strong>Loading...</strong> <em></em>
                </div>
            </div>
            <input type="range" id="volumeSlider" min="0" max="1" step="0.01" value="1">
        </div>
    </div>

    <script>
    document.addEventListener('DOMContentLoaded', () => {
        const audio = document.getElementById('liveAudio');
        const playPauseBtn = document.getElementById('playPauseBtn');
        const muteBtn = document.getElementById('muteBtn');
        const volumeSlider = document.getElementById('volumeSlider');
        const currentTimeDisplay = document.getElementById('currentTime');
        const timeBar = document.getElementById('timeBar');
        // This element does not exist in the pop-up, so we set it to null.
        const soundWaves = null; 

        let playStartTime = null;

        // --- ICON SYNCHRONIZATION ---
        const setPlayButtonIcon = () => {
            if (!audio.paused) {
                playPauseBtn.innerHTML = '<i class="fas fa-pause"></i>';
                if (soundWaves) soundWaves.classList.add("playing");
                if (!playStartTime) playStartTime = Date.now();
            } else {
                playPauseBtn.innerHTML = '<i class="fas fa-play"></i>';
                if (soundWaves) soundWaves.classList.remove("playing");
            }
        };

        audio.play().catch(error => {
            console.warn("Autoplay was blocked. User interaction required.", error);
        });

        audio.addEventListener('play', setPlayButtonIcon);
        audio.addEventListener('pause', setPlayButtonIcon);
        audio.addEventListener('playing', setPlayButtonIcon);
        setPlayButtonIcon();

        // --- PLAYER CONTROLS ---
        playPauseBtn.addEventListener('click', () => {
            if (audio.paused) {
                audio.play().catch(e => console.error('Play failed:', e));
            } else {
                audio.pause();
            }
        });

        muteBtn.addEventListener('click', () => {
            audio.muted = !audio.muted;
            muteBtn.innerHTML = audio.muted
                ? '<i class="fas fa-volume-mute"></i>'
                : '<i class="fas fa-volume-up"></i>';
        });
        
        muteBtn.innerHTML = audio.muted
            ? '<i class="fas fa-volume-mute"></i>'
            : '<i class="fas fa-volume-up"></i>';

        volumeSlider.addEventListener('input', () => {
            audio.volume = volumeSlider.value;
        });
        
        // --- TIMER & TRACK FETCH ---
        setInterval(() => {
            if (!audio.paused && playStartTime) {
                const elapsed = Math.floor((Date.now() - playStartTime) / 1000);
                const mins = String(Math.floor(elapsed / 60)).padStart(2, '0');
                const secs = String(elapsed % 60).padStart(2, '0');
                currentTimeDisplay.textContent = `${mins}:${secs}`;
                timeBar.value = (elapsed % 100);
            }
        }, 1000);

        // --- MODIFIED Track Fetch ---
        async function fetchLiveTrack() {
            try {
                // Add cache-busting param to prevent stale data
                const res = await fetch('https://www.jam-on.ch/tracklist/currentlyplaying.json?t=' + Date.now());
                const data = await res.json();

                // Get the elements *inside* the pop-up player
                const trackTitleElement = document.querySelector(".now-playing-info strong");
                const trackArtistElement = document.querySelector(".now-playing-info em");
                
                // Update the pop-up player's text
                if (trackTitleElement) trackTitleElement.textContent = data.track || "Unknown Track";
                if (trackArtistElement) trackArtistElement.textContent = data.artist ? `by ${data.artist}` : "Unknown Artist";

                // This element does not exist here, so we ignore it.
                // const trackImageElement = document.getElementById("trackImage");
                // if (trackImageElement) trackImageElement.src = data.cover || "https://www.jam-on.ch/tracklist/art-00.jpg";

            } catch (error) {
                console.error("Error fetching live track info:", error);
            }
        }
        fetchLiveTrack();
        setInterval(fetchLiveTrack, 20000); // Check every 20 seconds
    });
    </script>
 

<script>
        window.addEventListener('beforeunload', function(e) {
            // Set a flag so the main site knows the user closed this
            localStorage.setItem('playerManuallyClosed', 'true');
        });
    </script>
    </body>
</html>

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists