![]() 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/-589ff20d/ |
<?php
session_start();
$page_title = 'Test Community Player';
$current_page = 'test';
include 'includes/header.php';
?>
<div style="padding: 2rem; color: white;">
<h1>🎵 Community Player Test</h1>
<div style="margin: 2rem 0;">
<h2>Test Buttons:</h2>
<button onclick="testCommunityPlayTrack()" style="padding: 1rem 2rem; margin: 0.5rem; background: #667eea; color: white; border: none; border-radius: 8px; cursor: pointer;">
🎵 Test Community PlayTrack
</button>
<button onclick="testGlobalPlayer()" style="padding: 1rem 2rem; margin: 0.5rem; background: #48bb78; color: white; border: none; border-radius: 8px; cursor: pointer;">
🌐 Test Global Player
</button>
<button onclick="checkPlayerStatus()" style="padding: 1rem 2rem; margin: 0.5rem; background: #f56565; color: white; border: none; border-radius: 8px; cursor: pointer;">
🔍 Check Player Status
</button>
</div>
<div style="margin: 2rem 0;">
<h2>Debug Info:</h2>
<div id="debugInfo" style="background: rgba(255,255,255,0.1); padding: 1rem; border-radius: 8px; font-family: monospace; white-space: pre-wrap;">
Loading...
</div>
</div>
</div>
<script>
// Copy the exact playTrack function from community_fixed.php
function playTrack(audioUrl, title, artist, trackId) {
console.log('🎵 Community playTrack called:', { audioUrl, title, artist, trackId });
// Use enhancedGlobalPlayer directly (same as homepage)
if (window.enhancedGlobalPlayer && typeof window.enhancedGlobalPlayer.playTrack === 'function') {
console.log('🎵 Using enhancedGlobalPlayer');
try {
window.enhancedGlobalPlayer.playTrack(audioUrl, title, artist, trackId);
} catch (error) {
console.error('🎵 Error calling playTrack:', error);
alert('Error playing track. Please try again.');
}
} else if (typeof window.waitForGlobalPlayer === 'function') {
console.log('🎵 Waiting for global player to be ready...');
window.waitForGlobalPlayer(() => {
console.log('🎵 Global player ready, playing track');
try {
window.enhancedGlobalPlayer.playTrack(audioUrl, title, artist, trackId);
} catch (error) {
console.error('🎵 Error calling playTrack after wait:', error);
alert('Error playing track. Please try again.');
}
});
} else {
console.error('🎵 Global player not available');
alert('Music player not ready. Please refresh the page and try again.');
}
}
function testCommunityPlayTrack() {
console.log('🎵 Testing community playTrack function...');
playTrack(
'https://soundstudiopro.com/assets/audio/sample-track.mp3',
'Test Track',
'Test Artist',
999
);
}
function testGlobalPlayer() {
console.log('🎵 Testing global player directly...');
if (window.enhancedGlobalPlayer) {
console.log('✅ Global player exists');
console.log('Available functions:', Object.keys(window.enhancedGlobalPlayer));
if (typeof window.enhancedGlobalPlayer.playTrack === 'function') {
console.log('✅ playTrack function available');
try {
window.enhancedGlobalPlayer.playTrack(
'https://soundstudiopro.com/assets/audio/sample-track.mp3',
'Test Track',
'Test Artist',
999
);
alert('✅ Global player playTrack called successfully!');
} catch (error) {
console.error('❌ Error calling playTrack:', error);
alert('❌ Error calling playTrack: ' + error.message);
}
} else {
console.error('❌ playTrack function not available');
alert('❌ playTrack function not available');
}
} else {
console.error('❌ Global player not available');
alert('❌ Global player not available');
}
}
function checkPlayerStatus() {
const info = {
'enhancedGlobalPlayer exists': !!window.enhancedGlobalPlayer,
'globalPlayerReady': !!window.globalPlayerReady,
'playTrack function': !!(window.enhancedGlobalPlayer && window.enhancedGlobalPlayer.playTrack),
'showPlayer function': !!(window.enhancedGlobalPlayer && window.enhancedGlobalPlayer.showPlayer),
'loadPlaylist function': !!(window.enhancedGlobalPlayer && window.enhancedGlobalPlayer.loadPlaylist),
'waitForGlobalPlayer function': !!window.waitForGlobalPlayer,
'Player element exists': !!document.getElementById('enhancedGlobalPlayer'),
'Audio element exists': !!document.getElementById('globalAudioElement')
};
const debugDiv = document.getElementById('debugInfo');
debugDiv.innerHTML = Object.entries(info)
.map(([key, value]) => `${key}: ${value ? '✅' : '❌'}`)
.join('\n');
console.log('🎵 Player status:', info);
}
// Update debug info every 3 seconds
setInterval(checkPlayerStatus, 3000);
checkPlayerStatus();
// Check when DOM is loaded
document.addEventListener('DOMContentLoaded', function() {
console.log('🎵 DOM loaded, checking global player...');
checkPlayerStatus();
});
// Check when page is fully loaded
window.addEventListener('load', function() {
console.log('🎵 Page fully loaded, checking global player...');
checkPlayerStatus();
});
</script>
<?php include 'includes/footer.php'; ?>