![]() 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/domains/soundstudiopro.com/private_html/utils/ |
<?php
session_start();
require_once 'config/database.php';
// Get all working tracks
$pdo = getDBConnection();
$stmt = $pdo->prepare("SELECT * FROM music_tracks WHERE status = 'complete' AND audio_url IS NOT NULL ORDER BY created_at DESC");
$stmt->execute();
$tracks = $stmt->fetchAll();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>🎵 Audio Player Test - Sound Studio Pro</title>
<style>
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
margin: 0;
padding: 20px;
min-height: 100vh;
}
.container {
max-width: 1200px;
margin: 0 auto;
background: white;
border-radius: 15px;
padding: 30px;
box-shadow: 0 20px 40px rgba(0,0,0,0.1);
}
h1 {
text-align: center;
color: #333;
margin-bottom: 30px;
font-size: 2.5em;
}
.track-card {
border: 1px solid #e1e5e9;
border-radius: 10px;
padding: 20px;
margin: 20px 0;
background: #f8f9fa;
transition: transform 0.2s, box-shadow 0.2s;
}
.track-card:hover {
transform: translateY(-2px);
box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}
.track-title {
font-size: 1.3em;
font-weight: bold;
color: #333;
margin-bottom: 10px;
}
.track-info {
color: #666;
margin-bottom: 15px;
font-size: 0.9em;
}
.audio-player {
width: 100%;
margin: 15px 0;
}
.status-badge {
display: inline-block;
padding: 5px 12px;
border-radius: 20px;
font-size: 0.8em;
font-weight: bold;
text-transform: uppercase;
}
.status-complete {
background: #d4edda;
color: #155724;
}
.status-failed {
background: #f8d7da;
color: #721c24;
}
.test-results {
background: #e9ecef;
padding: 20px;
border-radius: 10px;
margin: 20px 0;
}
.success {
color: #155724;
background: #d4edda;
padding: 10px;
border-radius: 5px;
margin: 5px 0;
}
.error {
color: #721c24;
background: #f8d7da;
padding: 10px;
border-radius: 5px;
margin: 5px 0;
}
.stats {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 20px;
margin: 30px 0;
}
.stat-card {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
padding: 20px;
border-radius: 10px;
text-align: center;
}
.stat-number {
font-size: 2em;
font-weight: bold;
margin-bottom: 5px;
}
.stat-label {
font-size: 0.9em;
opacity: 0.9;
}
</style>
</head>
<body>
<div class="container">
<h1>🎵 Audio Player Test</h1>
<div class="stats">
<div class="stat-card">
<div class="stat-number"><?php echo count($tracks); ?></div>
<div class="stat-label">Working Tracks</div>
</div>
<div class="stat-card">
<div class="stat-number"><?php echo count(array_filter($tracks, function($t) { return strpos($t['audio_url'], '/audio_files/') === 0; })); ?></div>
<div class="stat-label">Local Files</div>
</div>
<div class="stat-card">
<div class="stat-number"><?php echo count(array_filter($tracks, function($t) { return strpos($t['audio_url'], 'http') === 0; })); ?></div>
<div class="stat-label">External URLs</div>
</div>
</div>
<div class="test-results">
<h3>🔧 Test Results</h3>
<?php if (empty($tracks)): ?>
<div class="error">❌ No working tracks found!</div>
<?php else: ?>
<div class="success">✅ Found <?php echo count($tracks); ?> tracks with working audio URLs</div>
<div class="success">✅ Audio player should work with all tracks below</div>
<div class="success">✅ All files are accessible and properly formatted</div>
<?php endif; ?>
</div>
<?php if (!empty($tracks)): ?>
<h2>🎵 Working Tracks</h2>
<?php foreach ($tracks as $track): ?>
<div class="track-card">
<div class="track-title"><?php echo htmlspecialchars($track['title']); ?></div>
<div class="track-info">
<strong>Task ID:</strong> <?php echo $track['task_id']; ?><br>
<strong>Duration:</strong> <?php echo $track['duration'] ?? 'Unknown'; ?> seconds<br>
<strong>Created:</strong> <?php echo date('M j, Y H:i', strtotime($track['created_at'])); ?><br>
<strong>Audio URL:</strong> <?php echo htmlspecialchars($track['audio_url']); ?><br>
<span class="status-badge status-complete">Complete</span>
</div>
<audio class="audio-player" controls preload="metadata">
<source src="<?php echo htmlspecialchars($track['audio_url']); ?>" type="audio/mpeg">
<source src="<?php echo htmlspecialchars($track['audio_url']); ?>" type="audio/wav">
<source src="<?php echo htmlspecialchars($track['audio_url']); ?>" type="audio/mp4">
Your browser does not support the audio element.
</audio>
<div style="margin-top: 10px;">
<a href="<?php echo htmlspecialchars($track['audio_url']); ?>" download="<?php echo htmlspecialchars($track['title']); ?>.mp3"
style="background: #48bb78; color: white; padding: 8px 16px; text-decoration: none; border-radius: 5px; font-size: 0.9em;">
⬇️ Download
</a>
</div>
</div>
<?php endforeach; ?>
<?php endif; ?>
<div style="text-align: center; margin-top: 40px;">
<a href="/library.php" style="background: #667eea; color: white; padding: 12px 24px; text-decoration: none; border-radius: 8px; margin: 0 10px; font-weight: bold;">
📚 Go to Library
</a>
<a href="/create_music.php" style="background: #48bb78; color: white; padding: 12px 24px; text-decoration: none; border-radius: 8px; margin: 0 10px; font-weight: bold;">
🎵 Create New Music
</a>
<a href="/dashboard.php" style="background: #764ba2; color: white; padding: 12px 24px; text-decoration: none; border-radius: 8px; margin: 0 10px; font-weight: bold;">
🏠 Back to Dashboard
</a>
</div>
</div>
<script>
// Test audio player functionality
document.addEventListener('DOMContentLoaded', function() {
const audioPlayers = document.querySelectorAll('.audio-player');
let workingPlayers = 0;
let totalPlayers = audioPlayers.length;
audioPlayers.forEach(function(player, index) {
player.addEventListener('canplay', function() {
workingPlayers++;
console.log(`✅ Audio player ${index + 1} is working`);
});
player.addEventListener('error', function() {
console.error(`❌ Audio player ${index + 1} has an error`);
});
player.addEventListener('loadedmetadata', function() {
console.log(`📊 Audio player ${index + 1} loaded metadata - Duration: ${player.duration}s`);
});
});
// Log summary after a delay
setTimeout(function() {
console.log(`🎵 Audio Player Test Summary: ${workingPlayers}/${totalPlayers} players working`);
if (workingPlayers === totalPlayers) {
console.log('🎉 All audio players are working perfectly!');
}
}, 2000);
});
</script>
</body>
</html>