754 lines
25 KiB
PHP
754 lines
25 KiB
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
require_once __DIR__ . '/includes/tracker.php';
|
|
track_visitor();
|
|
|
|
$projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? 'Lili Records Radio - La mejor música en vivo.';
|
|
$projectImageUrl = $_SERVER['PROJECT_IMAGE_URL'] ?? 'assets/pasted-20260215-151251-1c7b1936.png';
|
|
|
|
// WhatsApp info
|
|
$whatsapp_link = "https://chat.whatsapp.com/DkG96pTzAFO3hvLqmzwmTY";
|
|
$whatsapp_number = '+5359177041';
|
|
$facebook_link = "https://www.facebook.com/profile.php?id=61587890927489";
|
|
?>
|
|
<!doctype html>
|
|
<html lang="es">
|
|
<head>
|
|
<meta charset="utf-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
<title>Lili Records Radio</title>
|
|
|
|
<!-- Meta tags SEO -->
|
|
<meta name="description" content="<?= htmlspecialchars($projectDescription) ?>" />
|
|
<meta property="og:title" content="Lili Records Radio" />
|
|
<meta property="og:description" content="<?= htmlspecialchars($projectDescription) ?>" />
|
|
<meta property="og:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
|
|
<meta property="twitter:card" content="summary_large_image" />
|
|
|
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;700&display=swap" rel="stylesheet">
|
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.1/font/bootstrap-icons.css">
|
|
|
|
<style>
|
|
:root {
|
|
--accent-color: #00e676; /* WhatsApp Green */
|
|
--primary-color: #38bdf8; /* Sky Blue */
|
|
--bg-overlay: rgba(15, 23, 42, 0.5); /* More transparent overlay */
|
|
--glass-bg: rgba(15, 23, 42, 0.3); /* Transparent card background */
|
|
--glass-border: rgba(255, 255, 255, 0.2);
|
|
}
|
|
|
|
body, html {
|
|
margin: 0;
|
|
padding: 0;
|
|
width: 100%;
|
|
height: 100%;
|
|
font-family: 'Inter', sans-serif;
|
|
color: #ffffff;
|
|
background-color: #000;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.background {
|
|
position: fixed;
|
|
top: 0;
|
|
left: 0;
|
|
width: 100%;
|
|
height: 100%;
|
|
background: url('assets/images/background.jpg') center/cover no-repeat;
|
|
z-index: -1;
|
|
}
|
|
|
|
.background::after {
|
|
content: '';
|
|
position: absolute;
|
|
top: 0;
|
|
left: 0;
|
|
width: 100%;
|
|
height: 100%;
|
|
background: var(--bg-overlay);
|
|
}
|
|
|
|
/* Animated Mic Background Elements */
|
|
.bg-elements {
|
|
position: fixed;
|
|
top: 0;
|
|
left: 0;
|
|
width: 100%;
|
|
height: 100%;
|
|
pointer-events: none;
|
|
z-index: 0;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.floating-mic {
|
|
position: absolute;
|
|
font-size: 2rem;
|
|
opacity: 0.2;
|
|
color: var(--primary-color);
|
|
animation: float-around 20s infinite linear;
|
|
filter: drop-shadow(0 0 10px currentColor);
|
|
}
|
|
|
|
@keyframes float-around {
|
|
0% { transform: translate(0, 0) rotate(0deg); color: #38bdf8; }
|
|
25% { transform: translate(100px, 100px) rotate(90deg); color: #00e676; }
|
|
50% { transform: translate(200px, 0) rotate(180deg); color: #facc15; }
|
|
75% { transform: translate(100px, -100px) rotate(270deg); color: #f472b6; }
|
|
100% { transform: translate(0, 0) rotate(360deg); color: #38bdf8; }
|
|
}
|
|
|
|
.floating-mic:nth-child(1) { top: 10%; left: 10%; animation-duration: 25s; }
|
|
.floating-mic:nth-child(2) { top: 20%; left: 80%; animation-duration: 30s; animation-delay: -5s; }
|
|
.floating-mic:nth-child(3) { top: 70%; left: 15%; animation-duration: 22s; animation-delay: -10s; }
|
|
.floating-mic:nth-child(4) { top: 80%; left: 75%; animation-duration: 35s; animation-delay: -15s; }
|
|
.floating-mic:nth-child(5) { top: 40%; left: 40%; animation-duration: 28s; animation-delay: -2s; }
|
|
|
|
.app-container {
|
|
display: flex;
|
|
width: 100%;
|
|
height: 100vh;
|
|
align-items: center;
|
|
padding: 2rem;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
/* Left Side: Player */
|
|
.player-section {
|
|
flex: 1;
|
|
display: flex;
|
|
flex-direction: column;
|
|
justify-content: center;
|
|
max-width: 500px;
|
|
z-index: 10;
|
|
}
|
|
|
|
.glass-card {
|
|
background: var(--glass-bg);
|
|
backdrop-filter: blur(8px);
|
|
-webkit-backdrop-filter: blur(8px);
|
|
border: 1px solid var(--glass-border);
|
|
border-radius: 24px;
|
|
padding: 2.5rem;
|
|
box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
|
|
}
|
|
|
|
.brand h1 {
|
|
font-size: 2.5rem;
|
|
font-weight: 700;
|
|
margin: 0 0 0.5rem;
|
|
background: linear-gradient(to right, #fff, var(--primary-color));
|
|
-webkit-background-clip: text;
|
|
-webkit-text-fill-color: transparent;
|
|
}
|
|
|
|
.brand p {
|
|
font-size: 1rem;
|
|
opacity: 0.8;
|
|
margin-bottom: 2rem;
|
|
}
|
|
|
|
/* Radio Player UI */
|
|
.radio-player {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 1.5rem;
|
|
}
|
|
|
|
.now-playing {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 1rem;
|
|
background: rgba(0, 0, 0, 0.3);
|
|
padding: 1rem;
|
|
border-radius: 12px;
|
|
}
|
|
|
|
.now-playing i {
|
|
font-size: 1.5rem;
|
|
color: var(--primary-color);
|
|
animation: pulse 2s infinite;
|
|
}
|
|
|
|
.track-info {
|
|
overflow: hidden;
|
|
}
|
|
|
|
.track-title {
|
|
font-weight: 600;
|
|
font-size: 1.1rem;
|
|
white-space: nowrap;
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
}
|
|
|
|
.track-status {
|
|
font-size: 0.85rem;
|
|
opacity: 0.6;
|
|
}
|
|
|
|
.controls {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 1rem;
|
|
}
|
|
|
|
.play-btn {
|
|
width: 64px;
|
|
height: 64px;
|
|
border-radius: 50%;
|
|
background: var(--primary-color);
|
|
border: none;
|
|
color: #fff;
|
|
font-size: 1.5rem;
|
|
cursor: pointer;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
|
|
box-shadow: 0 4px 15px rgba(56, 189, 248, 0.4);
|
|
}
|
|
|
|
.play-btn.playing {
|
|
background: #ff4444 !important;
|
|
box-shadow: 0 4px 20px rgba(255, 68, 68, 0.5);
|
|
transform: scale(1.1);
|
|
animation: pulse-button 1.5s infinite;
|
|
}
|
|
|
|
@keyframes pulse-button {
|
|
0% { box-shadow: 0 0 0 0 rgba(255, 68, 68, 0.7); }
|
|
70% { box-shadow: 0 0 0 15px rgba(255, 68, 68, 0); }
|
|
100% { box-shadow: 0 0 0 0 rgba(255, 68, 68, 0); }
|
|
}
|
|
|
|
.play-btn:hover {
|
|
transform: scale(1.05);
|
|
background: #0ea5e9;
|
|
}
|
|
|
|
.visualizer-container {
|
|
width: 100%;
|
|
height: 100px;
|
|
margin-bottom: 1rem;
|
|
display: flex;
|
|
align-items: flex-end;
|
|
justify-content: center;
|
|
overflow: hidden;
|
|
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
|
|
}
|
|
|
|
#visualizer {
|
|
width: 100%;
|
|
height: 100%;
|
|
filter: drop-shadow(0 0 8px rgba(0, 230, 118, 0.5));
|
|
}
|
|
|
|
/* Playing Animations */
|
|
body.is-playing .glass-card {
|
|
animation: card-pulse 4s infinite ease-in-out;
|
|
border-color: rgba(56, 189, 248, 0.5);
|
|
}
|
|
|
|
body.is-playing .featured-img-container {
|
|
animation: float-img 6s infinite ease-in-out;
|
|
box-shadow: 0 0 50px var(--dynamic-glow, rgba(56, 189, 248, 0.6)),
|
|
0 0 100px var(--dynamic-glow-dim, rgba(56, 189, 248, 0.3));
|
|
border: 4px solid var(--dynamic-glow, rgba(255, 255, 255, 0.2));
|
|
}
|
|
|
|
.featured-img-container {
|
|
width: 100%;
|
|
max-width: 900px;
|
|
position: relative;
|
|
border-radius: 32px;
|
|
overflow: hidden;
|
|
box-shadow: 0 30px 80px rgba(0, 0, 0, 0.7);
|
|
aspect-ratio: 16 / 10;
|
|
transition: all 0.5s ease;
|
|
}
|
|
|
|
@keyframes card-pulse {
|
|
0%, 100% { transform: scale(1); box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3); }
|
|
50% { transform: scale(1.01); box-shadow: 0 12px 40px 0 rgba(56, 189, 248, 0.2); }
|
|
}
|
|
|
|
@keyframes float-img {
|
|
0%, 100% { transform: translateY(0) scale(1); }
|
|
50% { transform: translateY(-15px) scale(1.02); }
|
|
}
|
|
|
|
.volume-slider {
|
|
flex: 1;
|
|
height: 6px;
|
|
-webkit-appearance: none;
|
|
background: rgba(255, 255, 255, 0.2);
|
|
border-radius: 3px;
|
|
outline: none;
|
|
}
|
|
|
|
.volume-slider::-webkit-slider-thumb {
|
|
-webkit-appearance: none;
|
|
width: 16px;
|
|
height: 16px;
|
|
background: #fff;
|
|
border-radius: 50%;
|
|
cursor: pointer;
|
|
}
|
|
|
|
/* Interaction Form */
|
|
.interaction-form {
|
|
margin-top: 2rem;
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 1rem;
|
|
text-align: left;
|
|
}
|
|
|
|
.interaction-form label {
|
|
font-size: 0.85rem;
|
|
font-weight: 600;
|
|
margin-bottom: -0.5rem;
|
|
opacity: 0.9;
|
|
}
|
|
|
|
.interaction-form input,
|
|
.interaction-form textarea {
|
|
width: 100%;
|
|
padding: 0.8rem;
|
|
border-radius: 12px;
|
|
border: 1px solid rgba(255, 255, 255, 0.2);
|
|
background-color: rgba(255, 255, 255, 0.9); /* Semi-transparent white */
|
|
color: #0f172a;
|
|
font-family: inherit;
|
|
font-size: 0.95rem;
|
|
box-sizing: border-box;
|
|
outline: none;
|
|
transition: all 0.2s;
|
|
}
|
|
|
|
.interaction-form textarea {
|
|
resize: none;
|
|
height: 80px;
|
|
}
|
|
|
|
.interaction-form input::placeholder,
|
|
.interaction-form textarea::placeholder {
|
|
color: #64748b;
|
|
}
|
|
|
|
.send-whatsapp-btn {
|
|
background-color: var(--accent-color);
|
|
color: #fff;
|
|
border: none;
|
|
padding: 0.8rem;
|
|
border-radius: 12px;
|
|
font-weight: 700;
|
|
cursor: pointer;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
gap: 0.5rem;
|
|
transition: transform 0.2s, background 0.2s;
|
|
}
|
|
|
|
.send-whatsapp-btn:hover {
|
|
transform: translateY(-2px);
|
|
background-color: #00c853;
|
|
}
|
|
|
|
/* Right Side: Featured Image */
|
|
.image-section {
|
|
flex: 2;
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
padding-left: 3rem;
|
|
}
|
|
|
|
.featured-img-container {
|
|
width: 100%;
|
|
max-width: 900px;
|
|
position: relative;
|
|
border-radius: 32px;
|
|
overflow: hidden;
|
|
box-shadow: 0 30px 80px rgba(0, 0, 0, 0.7);
|
|
aspect-ratio: 16 / 10;
|
|
}
|
|
|
|
.featured-img-container img {
|
|
width: 100%;
|
|
height: 100%;
|
|
object-fit: cover;
|
|
transition: transform 0.5s;
|
|
}
|
|
|
|
.featured-img-container:hover img {
|
|
transform: scale(1.05);
|
|
}
|
|
|
|
/* Transfermovil QR Section */
|
|
.payment-section {
|
|
margin-top: 2rem;
|
|
text-align: center;
|
|
}
|
|
|
|
.qr-placeholder {
|
|
width: 180px;
|
|
height: 180px;
|
|
margin: 1rem auto;
|
|
background: rgba(255, 255, 255, 0.85);
|
|
border-radius: 12px;
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
justify-content: center;
|
|
color: #333;
|
|
padding: 10px;
|
|
backdrop-filter: blur(4px);
|
|
}
|
|
|
|
.qr-placeholder i {
|
|
font-size: 3rem;
|
|
margin-bottom: 10px;
|
|
color: #000;
|
|
}
|
|
|
|
.qr-placeholder span {
|
|
font-size: 0.75rem;
|
|
font-weight: 700;
|
|
text-transform: uppercase;
|
|
}
|
|
|
|
/* Floating Social Buttons */
|
|
.social-float-container {
|
|
position: fixed;
|
|
bottom: 2rem;
|
|
right: 2rem;
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 1rem;
|
|
z-index: 100;
|
|
}
|
|
|
|
.social-float {
|
|
width: 60px;
|
|
height: 60px;
|
|
color: #FFF;
|
|
border-radius: 50%;
|
|
text-align: center;
|
|
font-size: 28px;
|
|
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
text-decoration: none;
|
|
transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
|
|
}
|
|
|
|
.social-float:hover {
|
|
transform: scale(1.1) rotate(8deg);
|
|
color: #fff;
|
|
}
|
|
|
|
.social-float.whatsapp {
|
|
background-color: var(--accent-color);
|
|
box-shadow: 0 0 20px rgba(0, 230, 118, 0.5);
|
|
}
|
|
|
|
.social-float.youtube {
|
|
background-color: #ff0000;
|
|
box-shadow: 0 0 20px rgba(255, 0, 0, 0.5);
|
|
}
|
|
|
|
.social-float.facebook {
|
|
background-color: #1877F2;
|
|
box-shadow: 0 0 20px rgba(24, 119, 242, 0.5);
|
|
}
|
|
|
|
@keyframes pulse {
|
|
0% { transform: scale(1); opacity: 1; }
|
|
50% { transform: scale(1.1); opacity: 0.7; }
|
|
100% { transform: scale(1); opacity: 1; }
|
|
}
|
|
|
|
/* Responsive */
|
|
@media (max-width: 992px) {
|
|
.app-container {
|
|
flex-direction: column;
|
|
height: auto;
|
|
overflow-y: auto;
|
|
padding-top: 4rem;
|
|
}
|
|
.player-section {
|
|
max-width: 100%;
|
|
margin-bottom: 2rem;
|
|
}
|
|
.image-section {
|
|
padding-left: 0;
|
|
width: 100%;
|
|
}
|
|
.featured-img-container {
|
|
aspect-ratio: 1 / 1;
|
|
}
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="background"></div>
|
|
<div class="bg-elements">
|
|
<i class="bi bi-mic-fill floating-mic"></i>
|
|
<i class="bi bi-mic-fill floating-mic"></i>
|
|
<i class="bi bi-mic-fill floating-mic"></i>
|
|
<i class="bi bi-mic-fill floating-mic"></i>
|
|
<i class="bi bi-mic-fill floating-mic"></i>
|
|
</div>
|
|
|
|
<div class="app-container">
|
|
<!-- Left Section: Player -->
|
|
<section class="player-section">
|
|
<div class="glass-card">
|
|
<header class="brand">
|
|
<h1>Lili Records</h1>
|
|
<p>Siente la música, vive el ritmo.</p>
|
|
</header>
|
|
|
|
<div class="radio-player">
|
|
<div class="visualizer-container">
|
|
<canvas id="visualizer"></canvas>
|
|
</div>
|
|
<div class="now-playing">
|
|
<i class="bi bi-broadcast"></i>
|
|
<div class="track-info">
|
|
<div class="track-status">EN VIVO</div>
|
|
<div id="track-title" class="track-title">Cargando stream...</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="controls">
|
|
<button id="play-pause" class="play-btn" onclick="togglePlay()">
|
|
<i id="play-icon" class="bi bi-play-fill"></i>
|
|
</button>
|
|
<i class="bi bi-volume-up"></i>
|
|
<input type="range" class="volume-slider" min="0" max="1" step="0.01" value="1" oninput="changeVolume(this.value)">
|
|
</div>
|
|
|
|
<div class="interaction-form">
|
|
<label for="user-name">NOMBRE</label>
|
|
<input type="text" id="user-name" placeholder="Tu nombre...">
|
|
|
|
<label for="user-phone">MOVIL</label>
|
|
<input type="tel" id="user-phone" placeholder="Tu número..." onchange="savePhone(this.value)">
|
|
|
|
<label for="user-message">MENSAJE</label>
|
|
<textarea id="user-message" placeholder="¿Qué quieres escuchar?"></textarea>
|
|
|
|
<button class="send-whatsapp-btn" onclick="sendToWhatsApp()">
|
|
<i class="bi bi-whatsapp"></i> WHATSAPP
|
|
</button>
|
|
</div>
|
|
|
|
<!-- Espacio para Código QR -->
|
|
<div class="payment-section">
|
|
<div class="qr-placeholder">
|
|
<i class="bi bi-qr-code-scan"></i>
|
|
<span>TU CÓDIGO QR AQUÍ</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<?php if (isset($_GET['admin']) && $_GET['admin'] === '1'): ?>
|
|
<!-- Admin Real-Time Stats (Only visible with ?admin=1) -->
|
|
<div class="glass-card mt-4" style="margin-top: 2rem;">
|
|
<h3 style="font-size: 1.2rem; margin-bottom: 1rem; color: var(--accent-color);">
|
|
<i class="bi bi-shield-lock"></i> Panel Admin Real-Time
|
|
</h3>
|
|
<iframe src="admin.php?token=lili_admin_2026" style="width: 100%; height: 400px; border: none; border-radius: 12px; background: rgba(0,0,0,0.2);"></iframe>
|
|
</div>
|
|
<?php endif; ?>
|
|
</section>
|
|
|
|
|
|
<!-- Right Section: Featured Image -->
|
|
<section class="image-section">
|
|
<div class="featured-img-container">
|
|
<img src="assets/pasted-20260215-151251-1c7b1936.png" alt="Lili Records Featured">
|
|
</div>
|
|
</section>
|
|
</div>
|
|
|
|
<!-- Floating Social Links -->
|
|
<div class="social-float-container">
|
|
<a href="<?= $facebook_link ?>" class="social-float facebook" target="_blank" title="Facebook">
|
|
<i class="bi bi-facebook"></i>
|
|
</a>
|
|
<a href="https://www.youtube.com/@lilirecords" class="social-float youtube" target="_blank" title="YouTube">
|
|
<i class="bi bi-youtube"></i>
|
|
</a>
|
|
<a href="<?= $whatsapp_link ?>" class="social-float whatsapp" target="_blank" title="WhatsApp">
|
|
<i class="bi bi-whatsapp"></i>
|
|
</a>
|
|
</div>
|
|
|
|
<audio id="radio-audio" src="https://listen.radioking.com/radio/828046/stream/897251" preload="none" crossorigin="anonymous"></audio>
|
|
|
|
<script>
|
|
const audio = document.getElementById('radio-audio');
|
|
const playBtn = document.getElementById('play-pause');
|
|
const playIcon = document.getElementById('play-icon');
|
|
const trackTitle = document.getElementById('track-title');
|
|
const canvas = document.getElementById('visualizer');
|
|
const ctx = canvas.getContext('2d');
|
|
|
|
let audioCtx;
|
|
let analyzer;
|
|
let source;
|
|
let animationId;
|
|
|
|
function initVisualizer() {
|
|
if (audioCtx) return;
|
|
|
|
audioCtx = new (window.AudioContext || window.webkitAudioContext)();
|
|
analyzer = audioCtx.createAnalyser();
|
|
source = audioCtx.createMediaElementSource(audio);
|
|
source.connect(analyzer);
|
|
analyzer.connect(audioCtx.destination);
|
|
|
|
analyzer.fftSize = 128;
|
|
const bufferLength = analyzer.frequencyBinCount;
|
|
const dataArray = new Uint8Array(bufferLength);
|
|
|
|
canvas.width = canvas.offsetWidth;
|
|
canvas.height = canvas.offsetHeight;
|
|
|
|
let hue = 0;
|
|
function draw() {
|
|
animationId = requestAnimationFrame(draw);
|
|
analyzer.getByteFrequencyData(dataArray);
|
|
|
|
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
|
|
const barWidth = (canvas.width / bufferLength) * 2.5;
|
|
let barHeight;
|
|
let x = 0;
|
|
|
|
// Calcular intensidad promedio para reactividad
|
|
let sum = 0;
|
|
for(let i=0; i<bufferLength; i++) sum += dataArray[i];
|
|
const average = sum / bufferLength;
|
|
|
|
// Rotar el color base según el tiempo y la intensidad
|
|
hue = (hue + 0.5 + (average / 50)) % 360;
|
|
|
|
// Actualizar el resplandor de la imagen con el color actual y reactividad
|
|
const glowOpacity = 0.4 + (average / 255) * 0.5;
|
|
const glowSize = 30 + (average / 255) * 40;
|
|
const currentGlow = `hsla(${hue}, 80%, 60%, ${glowOpacity})`;
|
|
const currentGlowDim = `hsla(${hue}, 80%, 60%, ${glowOpacity * 0.5})`;
|
|
|
|
document.documentElement.style.setProperty('--dynamic-glow', currentGlow);
|
|
document.documentElement.style.setProperty('--dynamic-glow-dim', currentGlowDim);
|
|
|
|
for (let i = 0; i < bufferLength; i++) {
|
|
barHeight = (dataArray[i] / 255) * canvas.height;
|
|
|
|
// Color dinámico basado en hue, índice de barra e intensidad
|
|
const barHue = (hue + (i * 2)) % 360;
|
|
const saturation = 80 + (average / 255) * 20;
|
|
const lightness = 50 + (dataArray[i] / 255) * 25;
|
|
|
|
const gradient = ctx.createLinearGradient(0, canvas.height, 0, canvas.height - barHeight);
|
|
gradient.addColorStop(0, `hsl(${barHue}, ${saturation}%, ${lightness}%)`);
|
|
gradient.addColorStop(1, `hsl(${(barHue + 40) % 360}, ${saturation}%, ${lightness + 10}%)`);
|
|
|
|
ctx.fillStyle = gradient;
|
|
ctx.shadowBlur = 15;
|
|
ctx.shadowColor = `hsla(${barHue}, ${saturation}%, ${lightness}%, 0.5)`;
|
|
|
|
// Rounded bars
|
|
ctx.beginPath();
|
|
ctx.roundRect(x, canvas.height - barHeight, barWidth - 3, barHeight, 4);
|
|
ctx.fill();
|
|
|
|
x += barWidth;
|
|
}
|
|
}
|
|
draw();
|
|
}
|
|
|
|
function togglePlay() {
|
|
if (audioCtx && audioCtx.state === 'suspended') {
|
|
audioCtx.resume();
|
|
}
|
|
|
|
if (audio.paused) {
|
|
initVisualizer();
|
|
audio.play();
|
|
playIcon.classList.remove('bi-play-fill');
|
|
playIcon.classList.add('bi-pause-fill');
|
|
playBtn.classList.add('playing');
|
|
document.body.classList.add('is-playing');
|
|
} else {
|
|
audio.pause();
|
|
playIcon.classList.remove('bi-pause-fill');
|
|
playIcon.classList.add('bi-play-fill');
|
|
playBtn.classList.remove('playing');
|
|
document.body.classList.remove('is-playing');
|
|
}
|
|
}
|
|
|
|
function changeVolume(val) {
|
|
audio.volume = val;
|
|
}
|
|
|
|
function savePhone(phone) {
|
|
const formData = new FormData();
|
|
formData.append('phone', phone);
|
|
fetch('api/save_phone.php', {
|
|
method: 'POST',
|
|
body: formData
|
|
});
|
|
}
|
|
|
|
function sendToWhatsApp() {
|
|
window.open('<?= $whatsapp_link ?>', '_blank');
|
|
}
|
|
|
|
// Fetch Now Playing Metadata from RadioKing
|
|
async function updateMetadata() {
|
|
try {
|
|
// RadioKing Public API for current track
|
|
const response = await fetch('https://api.radioking.io/widget/radio/828046/track/current');
|
|
const data = await response.json();
|
|
if (data && data.title) {
|
|
const title = data.artist ? `${data.artist} - ${data.title}` : data.title;
|
|
trackTitle.textContent = title;
|
|
document.title = `▶ ${title} | Lili Records Radio`;
|
|
} else {
|
|
trackTitle.textContent = "Lili Records Radio - En Vivo";
|
|
}
|
|
} catch (error) {
|
|
console.error('Error fetching metadata:', error);
|
|
trackTitle.textContent = "Lili Records Radio - En Vivo";
|
|
}
|
|
}
|
|
|
|
// Update every 30 seconds
|
|
updateMetadata();
|
|
setInterval(updateMetadata, 30000);
|
|
|
|
// Handle possible audio interruptions
|
|
audio.addEventListener('error', function(e) {
|
|
console.error('Audio error:', e);
|
|
trackTitle.textContent = "Error de conexión. Reintentando...";
|
|
setTimeout(() => {
|
|
audio.load();
|
|
if (!audio.paused) audio.play();
|
|
}, 5000);
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|