![]() 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/-3d4fae88/ |
<?php
require_once 'config/database.php';
?>
<!DOCTYPE html>
<html>
<head>
<title>Simple Preview Test</title>
<style>
body { font-family: Arial, sans-serif; margin: 20px; background: #1a1a1a; color: white; }
.test-section { background: #333; padding: 20px; margin: 20px 0; border-radius: 10px; }
.preview-btn { background: #667eea; color: white; border: none; padding: 10px 20px; border-radius: 5px; cursor: pointer; margin: 5px; }
.test-btn { background: #48bb78; color: white; border: none; padding: 10px 20px; border-radius: 5px; cursor: pointer; margin: 5px; }
</style>
</head>
<body>
<h1>Simple Preview Test</h1>
<div class="test-section">
<h2>Test Preview Buttons</h2>
<button class="preview-btn play-track-btn"
data-audio-url="https://apiboxfiles.erweima.ai/MTk4YTg3OGYtM2Y4NS00YWJhLWIxMjMtMjk1OWFjOTUwMDFk.mp3"
data-title="Test Track 1"
data-artist="Test Artist"
data-track-id="999">
<i class="fas fa-play"></i> Preview
</button>
<button class="preview-btn play-track-btn"
data-audio-url="https://apiboxfiles.erweima.ai/OWQ1Y2Q0YzAtZGU1NS00MTY4LTlmNTYtNTY4YWJjNDhlMTE4.mp3"
data-title="Test Track 2"
data-artist="Test Artist"
data-track-id="998">
<i class="fas fa-play"></i> Preview
</button>
<button class="test-btn" onclick="testDirectCall()">Test Direct Call</button>
<div id="debug-output" style="margin-top: 10px; padding: 10px; background: #555; border-radius: 5px; min-height: 100px;"></div>
</div>
<script>
function log(message) {
const debugOutput = document.getElementById('debug-output');
const timestamp = new Date().toLocaleTimeString();
debugOutput.innerHTML += `<p>[${timestamp}] ${message}</p>`;
debugOutput.scrollTop = debugOutput.scrollHeight;
}
function testDirectCall() {
log('=== Testing Direct Call ===');
const testUrl = 'https://apiboxfiles.erweima.ai/MTk4YTg3OGYtM2Y4NS00YWJhLWIxMjMtMjk1OWFjOTUwMDFk.mp3';
const testTitle = 'Test Track';
const testArtist = 'Test Artist';
log(`Testing with: ${testTitle} by ${testArtist}`);
log(`Audio URL: ${testUrl}`);
if (typeof window.playTrackWithGlobalPlayer === 'function') {
try {
log('Calling window.playTrackWithGlobalPlayer...');
const result = window.playTrackWithGlobalPlayer(testUrl, testTitle, testArtist);
log(`Result: ${result}`);
} catch (error) {
log(`Error: ${error.message}`);
}
} else {
log('Global player function not available');
}
}
// Simple event listener setup
document.addEventListener('DOMContentLoaded', function() {
log('=== DOM Loaded - Setting up preview buttons ===');
const previewButtons = document.querySelectorAll('.preview-btn.play-track-btn');
log(`Found ${previewButtons.length} preview buttons`);
previewButtons.forEach((button, index) => {
log(`Setting up preview button ${index + 1}`);
button.addEventListener('click', function(e) {
log(`Preview button ${index + 1} clicked!`);
e.preventDefault();
const audioUrl = this.getAttribute('data-audio-url');
const title = this.getAttribute('data-title');
const artist = this.getAttribute('data-artist');
const trackId = this.getAttribute('data-track-id');
log(`Playing: ${title} by ${artist} (ID: ${trackId})`);
log(`Audio URL: ${audioUrl}`);
if (typeof window.playTrackWithGlobalPlayer === 'function') {
try {
const result = window.playTrackWithGlobalPlayer(audioUrl, title, artist);
log(`Play result: ${result}`);
} catch (error) {
log(`Play error: ${error.message}`);
}
} else {
log('Global player function not available');
}
});
});
});
// Auto-test on load
window.addEventListener('load', function() {
log('=== Page Loaded ===');
log(`window.globalPlayer exists: ${typeof window.globalPlayer !== 'undefined'}`);
log(`window.playTrackWithGlobalPlayer exists: ${typeof window.playTrackWithGlobalPlayer === 'function'}`);
});
</script>
<!-- Include global player -->
<?php include 'includes/global_player.php'; ?>
</body>
</html>