![]() 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/-648ba6b4/ |
<?php
session_start();
include 'includes/header.php';
include 'includes/global_player.php';
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Global Player Availability Test</title>
<style>
body {
font-family: 'Inter', sans-serif;
background: #0a0a0a;
color: white;
margin: 0;
padding: 20px;
}
.test-container {
max-width: 800px;
margin: 0 auto;
background: rgba(255, 255, 255, 0.05);
border-radius: 12px;
padding: 2rem;
border: 1px solid rgba(255, 255, 255, 0.1);
}
.status {
margin: 1rem 0;
padding: 1rem;
border-radius: 8px;
font-family: monospace;
background: rgba(0, 0, 0, 0.5);
border: 1px solid rgba(255, 255, 255, 0.1);
white-space: pre-wrap;
}
.btn {
background: linear-gradient(135deg, #667eea, #764ba2);
color: white;
border: none;
padding: 0.8rem 1.5rem;
border-radius: 8px;
font-size: 1rem;
font-weight: 600;
cursor: pointer;
transition: all 0.3s ease;
display: inline-flex;
align-items: center;
gap: 0.5rem;
margin: 0.5rem;
}
.btn:hover {
transform: translateY(-2px);
box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
}
</style>
</head>
<body>
<div class="test-container">
<h1>🎵 Global Player Availability Test</h1>
<p>This page tests if the global player is properly available (same as feed.php)</p>
<div id="status" class="status">Checking global player availability...</div>
<button class="btn" onclick="checkAvailability()">
🔍 Check Availability
</button>
<button class="btn" onclick="testPlay()">
🎵 Test Play
</button>
<button class="btn" onclick="forceInitialize()">
⚡ Force Initialize
</button>
</div>
<script>
function log(message) {
const statusElement = document.getElementById('status');
const timestamp = new Date().toLocaleTimeString();
statusElement.textContent += `[${timestamp}] ${message}\n`;
console.log(`[${timestamp}] ${message}`);
}
function checkAvailability() {
log('=== GLOBAL PLAYER AVAILABILITY CHECK ===');
// Check global player object
log(`window.globalPlayer: ${typeof window.globalPlayer !== 'undefined' ? 'EXISTS' : 'MISSING'}`);
if (typeof window.globalPlayer !== 'undefined') {
log(` - initialized: ${window.globalPlayer.initialized}`);
log(` - playTrack method: ${typeof window.globalPlayer.playTrack === 'function' ? 'EXISTS' : 'MISSING'}`);
log(` - showPlayer method: ${typeof window.globalPlayer.showPlayer === 'function' ? 'EXISTS' : 'MISSING'}`);
log(` - init method: ${typeof window.globalPlayer.init === 'function' ? 'EXISTS' : 'MISSING'}`);
}
// Check global functions
log(`window.playTrackWithGlobalPlayer: ${typeof window.playTrackWithGlobalPlayer === 'function' ? 'EXISTS' : 'MISSING'}`);
log(`window.ensureGlobalPlayer: ${typeof window.ensureGlobalPlayer === 'function' ? 'EXISTS' : 'MISSING'}`);
log(`initializeGlobalPlayer: ${typeof initializeGlobalPlayer === 'function' ? 'EXISTS' : 'MISSING'}`);
// Check DOM elements
const playerElement = document.getElementById('globalMusicPlayer');
log(`globalMusicPlayer element: ${playerElement ? 'EXISTS' : 'MISSING'}`);
if (playerElement) {
log(` - display: ${playerElement.style.display}`);
log(` - opacity: ${playerElement.style.opacity}`);
log(` - visibility: ${playerElement.style.visibility}`);
log(` - z-index: ${playerElement.style.zIndex}`);
}
log('=== END CHECK ===');
}
async function testPlay() {
log('=== TESTING PLAY FUNCTION ===');
const audioUrl = 'https://apiboxfiles.erweima.ai/MTk4YTg3OGYtM2Y4NS00YWJhLWIxMjMtMjk1OWFjOTUwMDFk.mp3';
const title = 'Test Track';
const artist = 'Test Artist';
const artistId = 1;
// Test Method 1: Global function
if (typeof window.playTrackWithGlobalPlayer === 'function') {
log('Testing Method 1: window.playTrackWithGlobalPlayer');
try {
const success = await window.playTrackWithGlobalPlayer(audioUrl, title, artist, artistId);
log(`Method 1 result: ${success ? 'SUCCESS' : 'FAILED'}`);
if (success) return;
} catch (error) {
log(`Method 1 error: ${error.message}`);
}
} else {
log('Method 1 skipped - function not available');
}
// Test Method 2: Direct global player
if (typeof window.globalPlayer !== 'undefined' && typeof window.globalPlayer.playTrack === 'function') {
log('Testing Method 2: window.globalPlayer.playTrack');
try {
window.globalPlayer.wasPlaying = true;
window.globalPlayer.playTrack(audioUrl, title, artist, artistId);
log('Method 2 called successfully');
return;
} catch (error) {
log(`Method 2 error: ${error.message}`);
}
} else {
log('Method 2 skipped - method not available');
}
// Test Method 3: Direct audio
log('Testing Method 3: Direct audio element');
try {
const audio = new Audio(audioUrl);
audio.volume = 0.5;
await audio.play();
log('Method 3 successful');
} catch (error) {
log(`Method 3 error: ${error.message}`);
}
log('=== END PLAY TEST ===');
}
function forceInitialize() {
log('=== FORCING INITIALIZATION ===');
// Force initialize global player
if (typeof initializeGlobalPlayer === 'function') {
log('Calling initializeGlobalPlayer()');
initializeGlobalPlayer();
} else {
log('initializeGlobalPlayer function not available');
}
// Force show player
if (typeof window.globalPlayer !== 'undefined' && typeof window.globalPlayer.showPlayer === 'function') {
log('Calling window.globalPlayer.showPlayer()');
window.globalPlayer.showPlayer();
} else {
log('showPlayer method not available');
}
// Force visibility with DOM manipulation
const playerElement = document.getElementById('globalMusicPlayer');
if (playerElement) {
log('Forcing player visibility with DOM manipulation');
playerElement.style.display = 'flex';
playerElement.style.opacity = '1';
playerElement.style.visibility = 'visible';
playerElement.style.zIndex = '9999';
} else {
log('Player element not found');
}
log('=== END FORCE INITIALIZATION ===');
}
// Initialize when page loads
window.addEventListener('load', function() {
log('Page loaded, checking initial availability...');
setTimeout(checkAvailability, 1000);
});
// Also check when DOM is ready
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', function() {
log('DOM loaded, checking availability...');
setTimeout(checkAvailability, 500);
});
} else {
log('DOM already loaded, checking availability...');
setTimeout(checkAvailability, 500);
}
</script>
</body>
</html>