![]() Server : Apache/2 System : Linux server-15-235-50-60 5.15.0-164-generic #174-Ubuntu SMP Fri Nov 14 20:25:16 UTC 2025 x86_64 User : gositeme ( 1004) PHP Version : 8.2.29 Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname Directory : /home/gositeme/.cursor-server/data/User/History/-54040e48/ |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Artist Profile Debug</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 20px;
background: #0a0a0a;
color: white;
}
.debug-section {
background: #1a1a1a;
padding: 20px;
margin: 20px 0;
border-radius: 8px;
border: 1px solid #333;
}
.test-button {
background: #667eea;
color: white;
border: none;
padding: 10px 20px;
margin: 5px;
border-radius: 4px;
cursor: pointer;
}
.test-button:hover {
background: #5a67d8;
}
.test-button.success {
background: #51cf66;
}
.test-button.error {
background: #ff6b6b;
}
.log {
background: #2a2a2a;
padding: 10px;
margin: 10px 0;
border-radius: 4px;
font-family: monospace;
white-space: pre-wrap;
max-height: 300px;
overflow-y: auto;
}
.track-item {
background: #333;
padding: 15px;
margin: 10px 0;
border-radius: 4px;
cursor: pointer;
border-left: 4px solid #667eea;
}
.track-item:hover {
background: #444;
}
</style>
</head>
<body>
<h1>🎵 Artist Profile Debug Page</h1>
<div class="debug-section">
<h2>🔧 Global Player Status</h2>
<div id="playerStatus">Checking...</div>
<button class="test-button" onclick="checkPlayerStatus()">Check Status</button>
<button class="test-button" onclick="forceInitialize()">Force Initialize</button>
</div>
<div class="debug-section">
<h2>🎵 Test Tracks</h2>
<div class="track-item" onclick="testPlayTrack('https://apiboxfiles.erweima.ai/MTk4YTg3OGYtM2Y4NS00YWJhLWIxMjMtMjk1OWFjOTUwMDFk.mp3', 'Lounge Lyrics', 'stephane bergeron')">
<strong>Lounge Lyrics</strong> - stephane bergeron
<br><small>Click to test playTrack function</small>
</div>
<div class="track-item" onclick="testDirectGlobalPlayer()">
<strong>Direct Global Player Test</strong>
<br><small>Click to test direct global player call</small>
</div>
<div class="track-item" onclick="testGlobalFunction()">
<strong>Global Function Test</strong>
<br><small>Click to test window.playTrackWithGlobalPlayer</small>
</div>
</div>
<div class="debug-section">
<h2>📝 Console Logs</h2>
<button class="test-button" onclick="clearLogs()">Clear Logs</button>
<div id="consoleLogs" class="log"></div>
</div>
<!-- Include the global player -->
<?php include 'includes/global_player.php'; ?>
<script>
// Override console.log to capture logs
const originalLog = console.log;
const originalError = console.error;
const originalWarn = console.warn;
function addLog(message, type = 'log') {
const logsDiv = document.getElementById('consoleLogs');
const timestamp = new Date().toLocaleTimeString();
const logEntry = document.createElement('div');
logEntry.className = type;
logEntry.textContent = `[${timestamp}] ${message}`;
logsDiv.appendChild(logEntry);
logsDiv.scrollTop = logsDiv.scrollHeight;
}
console.log = function(...args) {
originalLog.apply(console, args);
addLog(args.join(' '), 'success');
};
console.error = function(...args) {
originalError.apply(console, args);
addLog(args.join(' '), 'error');
};
console.warn = function(...args) {
originalWarn.apply(console, args);
addLog(args.join(' '), 'warning');
};
function checkPlayerStatus() {
const statusDiv = document.getElementById('playerStatus');
let status = '';
// Check if global player exists
if (typeof window.globalPlayer === 'undefined') {
status += '<div style="color: #ff6b6b;">❌ Global player not found</div>';
} else {
status += '<div style="color: #51cf66;">✅ Global player exists</div>';
// Check initialization
if (!window.globalPlayer.initialized) {
status += '<div style="color: #ffd43b;">⚠️ Global player not initialized</div>';
} else {
status += '<div style="color: #51cf66;">✅ Global player initialized</div>';
}
// Check audio element
if (!window.globalPlayer.audio) {
status += '<div style="color: #ffd43b;">⚠️ No audio element</div>';
} else {
status += '<div style="color: #51cf66;">✅ Audio element exists</div>';
}
// Check global functions
if (typeof window.playTrackWithGlobalPlayer === 'function') {
status += '<div style="color: #51cf66;">✅ Global playTrackWithGlobalPlayer function exists</div>';
} else {
status += '<div style="color: #ff6b6b;">❌ Global playTrackWithGlobalPlayer function missing</div>';
}
if (typeof window.ensureGlobalPlayer === 'function') {
status += '<div style="color: #51cf66;">✅ Global ensureGlobalPlayer function exists</div>';
} else {
status += '<div style="color: #ff6b6b;">❌ Global ensureGlobalPlayer function missing</div>';
}
}
statusDiv.innerHTML = status;
}
async function forceInitialize() {
console.log('🎵 Force initializing global player...');
if (typeof window.ensureGlobalPlayer === 'function') {
const success = await window.ensureGlobalPlayer();
console.log('🎵 ensureGlobalPlayer result:', success);
} else {
console.error('🎵 ensureGlobalPlayer function not available');
}
checkPlayerStatus();
}
async function testPlayTrack(audioUrl, title, artist) {
console.log('🎵 Testing playTrack function:', { audioUrl, title, artist });
// Test the exact function from artist_profile.php
try {
// Validate inputs
if (!audioUrl || audioUrl === 'null' || audioUrl === 'undefined') {
console.error('🎵 Invalid audio URL:', audioUrl);
alert('Invalid audio URL. Please try again.');
return;
}
if (!title || title === 'null' || title === 'undefined') {
console.error('🎵 Invalid title:', title);
alert('Invalid track title. Please try again.');
return;
}
// Use the global player function
const success = await window.playTrackWithGlobalPlayer(audioUrl, title, artist);
if (!success) {
console.error('🎵 Global player failed, showing error message');
alert(`Failed to play: ${title} by ${artist}. Please try again.`);
} else {
console.log('🎵 Track started successfully!');
}
} catch (error) {
console.error('🎵 Error in testPlayTrack:', error);
alert('Error playing track: ' + error.message);
}
}
async function testDirectGlobalPlayer() {
console.log('🎵 Testing direct global player call...');
if (typeof window.globalPlayer === 'undefined') {
console.error('🎵 Global player not available');
return;
}
if (typeof window.globalPlayer.playTrack !== 'function') {
console.error('🎵 Global player playTrack function not available');
return;
}
try {
console.log('🎵 Calling globalPlayer.playTrack directly...');
window.globalPlayer.playTrack(
'https://apiboxfiles.erweima.ai/MTk4YTg3OGYtM2Y4NS00YWJhLWIxMjMtMjk1OWFjOTUwMDFk.mp3',
'Direct Test Track',
'Test Artist'
);
console.log('🎵 Direct call completed');
} catch (error) {
console.error('🎵 Error in direct call:', error);
}
}
async function testGlobalFunction() {
console.log('🎵 Testing window.playTrackWithGlobalPlayer...');
if (typeof window.playTrackWithGlobalPlayer !== 'function') {
console.error('🎵 playTrackWithGlobalPlayer function not available');
return;
}
try {
const result = await window.playTrackWithGlobalPlayer(
'https://apiboxfiles.erweima.ai/MTk4YTg3OGYtM2Y4NS00YWJhLWIxMjMtMjk1OWFjOTUwMDFk.mp3',
'Global Function Test',
'Test Artist'
);
console.log('🎵 playTrackWithGlobalPlayer result:', result);
} catch (error) {
console.error('🎵 Error in global function test:', error);
}
}
function clearLogs() {
document.getElementById('consoleLogs').innerHTML = '';
}
// Auto-check status when page loads
document.addEventListener('DOMContentLoaded', () => {
console.log('🎵 Debug page loaded');
setTimeout(checkPlayerStatus, 1000);
setTimeout(checkPlayerStatus, 3000);
});
</script>
</body>
</html>