diff --git a/api/chat.php b/api/chat.php
new file mode 100644
index 0000000..1b9b389
--- /dev/null
+++ b/api/chat.php
@@ -0,0 +1,34 @@
+prepare("SELECT * FROM messages ORDER BY created_at DESC LIMIT 50");
+ $stmt->execute();
+ $messages = $stmt->fetchAll(PDO::FETCH_ASSOC);
+ echo json_encode(array_reverse($messages));
+ } catch (Exception $e) {
+ echo json_encode(['error' => $e->getMessage()]);
+ }
+} elseif ($method === 'POST') {
+ $input = json_decode(file_get_contents('php://input'), true);
+ $username = $input['username'] ?? 'Anónimo';
+ $message = $input['message'] ?? '';
+
+ if (empty($message)) {
+ echo json_encode(['error' => 'Mensaje vacío']);
+ exit;
+ }
+
+ try {
+ $stmt = db()->prepare("INSERT INTO messages (username, message) VALUES (?, ?)");
+ $stmt->execute([$username, $message]);
+ echo json_encode(['success' => true]);
+ } catch (Exception $e) {
+ echo json_encode(['error' => $e->getMessage()]);
+ }
+}
diff --git a/db/migrations/002_create_settings_table.sql b/db/migrations/002_create_settings_table.sql
new file mode 100644
index 0000000..aa65dd5
--- /dev/null
+++ b/db/migrations/002_create_settings_table.sql
@@ -0,0 +1,6 @@
+CREATE TABLE IF NOT EXISTS settings (
+ setting_key VARCHAR(50) PRIMARY KEY,
+ setting_value TEXT
+);
+
+INSERT IGNORE INTO settings (setting_key, setting_value) VALUES ('video_room_password', 'lili123');
diff --git a/index.php b/index.php
index ea152b0..6d64581 100644
--- a/index.php
+++ b/index.php
@@ -11,6 +11,12 @@ $projectImageUrl = $_SERVER['PROJECT_IMAGE_URL'] ?? 'assets/pasted-20260215-1646
$whatsapp_link = "https://chat.whatsapp.com/DkG96pTzAFO3hvLqmzwmTY";
$whatsapp_number = '+5359177041';
$facebook_link = "https://www.facebook.com/profile.php?id=61587890927489";
+
+// Fetch video room password
+$db = db();
+$stmt = $db->prepare("SELECT setting_value FROM settings WHERE setting_key = 'video_room_password'");
+$stmt->execute();
+$video_room_pass = $stmt->fetchColumn() ?: "lili123";
?>
@@ -592,10 +598,13 @@ $facebook_link = "https://www.facebook.com/profile.php?id=61587890927489";
overflow-y: auto;
padding-top: 4rem;
}
- .player-section {
- max-width: 100%;
+ .player-section, .interaction-center {
+ max-width: 100% !important;
margin-bottom: 2rem;
}
+ .interaction-center {
+ grid-template-columns: 1fr !important;
+ }
.image-section {
padding-left: 0;
width: 100%;
@@ -699,7 +708,47 @@ $facebook_link = "https://www.facebook.com/profile.php?id=61587890927489";
+
+
+
+
+
+ CHAT EN VIVO
+
+
+
+
Cargando mensajes...
+
+
+
+
+
+
+
+
+
+
+ VIDEO EN VIVO
+
+
+
+
+
+
Únete a la sala de video para que otros usuarios te vean en vivo.
+
+
Integrado con la comunidad Lili Records
+
+
+
+ LIVE
+
+
+
@@ -862,6 +911,71 @@ $facebook_link = "https://www.facebook.com/profile.php?id=61587890927489";
window.open('= $whatsapp_link ?>', '_blank');
}
+ // --- Chat Functionality ---
+ const chatMessages = document.getElementById('chat-messages');
+ const chatUser = document.getElementById('chat-user');
+ const chatMsg = document.getElementById('chat-msg');
+ let lastMessageCount = 0;
+
+ async function fetchMessages() {
+ try {
+ const response = await fetch('api/chat.php');
+ const messages = await response.json();
+
+ if (messages.length !== lastMessageCount) {
+ chatMessages.innerHTML = '';
+ messages.forEach(msg => {
+ const div = document.createElement('div');
+ div.style.background = 'rgba(255,255,255,0.05)';
+ div.style.padding = '0.8rem';
+ div.style.borderRadius = '12px';
+ div.style.borderLeft = `4px solid ${msg.username === chatUser.value ? 'var(--primary-color)' : 'rgba(255,255,255,0.2)'}`;
+
+ div.innerHTML = `
+
${msg.username}
+
${msg.message}
+
${new Date(msg.created_at).toLocaleTimeString([], {hour: '2-digit', minute:'2-digit'})}
+ `;
+ chatMessages.appendChild(div);
+ });
+ chatMessages.scrollTop = chatMessages.scrollHeight;
+ lastMessageCount = messages.length;
+ }
+ } catch (error) {
+ console.error('Chat error:', error);
+ }
+ }
+
+ async function sendChatMessage() {
+ const user = chatUser.value.trim() || 'Anónimo';
+ const message = chatMsg.value.trim();
+ if (!message) return;
+
+ try {
+ const response = await fetch('api/chat.php', {
+ method: 'POST',
+ headers: { 'Content-Type': 'application/json' },
+ body: JSON.stringify({ username: user, message: message })
+ });
+ const result = await response.json();
+ if (result.success) {
+ chatMsg.value = '';
+ fetchMessages();
+ }
+ } catch (error) {
+ console.error('Error sending message:', error);
+ }
+ }
+
+ chatMsg.addEventListener('keypress', (e) => {
+ if (e.key === 'Enter') sendChatMessage();
+ });
+
+ // Initial fetch and poll
+ fetchMessages();
+ setInterval(fetchMessages, 3000);
+ // --- End Chat Functionality ---
+
// Fetch Now Playing Metadata from RadioKing
async function updateMetadata() {
try {
@@ -921,6 +1035,48 @@ $facebook_link = "https://www.facebook.com/profile.php?id=61587890927489";
updateMetadata();
setInterval(updateMetadata, 30000);
+ // --- Video Call Functionality ---
+ function startVideo() {
+ const roomPassword = '= $video_room_pass ?>';
+ const userPass = prompt("Introduce la contraseña de la sala (Solicítala en el grupo de WhatsApp):");
+
+ if (userPass !== roomPassword) {
+ if (userPass !== null) alert("Contraseña incorrecta. Solo miembros autorizados pueden unirse.");
+ return;
+ }
+
+ const container = document.getElementById('video-container');
+ const placeholder = document.getElementById('jitsi-placeholder');
+ placeholder.style.display = 'none';
+
+ // Load Jitsi External API
+ const script = document.createElement('script');
+ script.src = "https://meet.jit.si/external_api.js";
+ script.onload = () => {
+ const domain = "meet.jit.si";
+ const options = {
+ roomName: "LiliRecordsLive_Sala_Privada_2026",
+ width: "100%",
+ height: "100%",
+ parentNode: container,
+ configOverwrite: {
+ startWithAudioMuted: true,
+ startWithVideoMuted: false,
+ prejoinPageEnabled: false
+ },
+ interfaceConfigOverwrite: {
+ TOOLBAR_BUTTONS: [
+ 'microphone', 'camera', 'closedcaptions', 'desktop', 'fullscreen',
+ 'fodeviceselection', 'hangup', 'profile', 'chat', 'settings', 'raisehand',
+ 'videoquality', 'filmstrip', 'tileview', 'videobackgroundblur'
+ ],
+ }
+ };
+ const api = new JitsiMeetExternalAPI(domain, options);
+ };
+ document.head.appendChild(script);
+ }
+
// Handle possible audio interruptions
audio.addEventListener('error', function(e) {
console.error('Audio error:', e);