![]() 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
// Create Test Audio Files for Player Testing
echo "šµ CREATING TEST AUDIO FILES\n\n";
// Create audio_files directory if it doesn't exist
$audioDir = './audio_files';
if (!is_dir($audioDir)) {
mkdir($audioDir, 0755, true);
echo "ā
Created audio_files directory\n";
} else {
echo "ā
audio_files directory exists\n";
}
// Create task_results directory if it doesn't exist
$resultsDir = './task_results';
if (!is_dir($resultsDir)) {
mkdir($resultsDir, 0755, true);
echo "ā
Created task_results directory\n";
} else {
echo "ā
task_results directory exists\n";
}
echo "\nš CREATING SAMPLE AUDIO FILES:\n";
// Create a simple test MP3 file (using a placeholder)
$testFiles = [
'test_sample_1.mp3' => 'Sample audio file 1 for testing',
'test_sample_2.wav' => 'Sample audio file 2 for testing',
'test_sample_3.m4a' => 'Sample audio file 3 for testing'
];
foreach ($testFiles as $filename => $description) {
$filepath = $audioDir . '/' . $filename;
if (!file_exists($filepath)) {
// Create a placeholder file with audio metadata
$content = "<!-- This is a placeholder audio file for testing -->\n";
$content .= "<!-- " . $description . " -->\n";
$content .= "<!-- Created: " . date('Y-m-d H:i:s') . " -->\n";
$content .= "<!-- File: " . $filename . " -->\n";
$content .= "<!-- Duration: 30 seconds -->\n";
$content .= "<!-- Format: " . pathinfo($filename, PATHINFO_EXTENSION) . " -->\n";
file_put_contents($filepath, $content);
echo "ā
Created: " . $filename . "\n";
} else {
echo "ā ļø Exists: " . $filename . "\n";
}
}
echo "\nš§ CREATING TEST DATABASE ENTRIES:\n";
// Include database configuration
require_once 'config/database.php';
$pdo = getDBConnection();
if ($pdo) {
echo "ā
Database connection successful\n";
// Create test tracks in database
$testTracks = [
[
'task_id' => 'test_audio_001',
'title' => 'Test Audio Sample 1',
'prompt' => 'A test audio file for player functionality testing',
'audio_url' => '/audio_files/test_sample_1.mp3',
'status' => 'complete'
],
[
'task_id' => 'test_audio_002',
'title' => 'Test Audio Sample 2',
'prompt' => 'Another test audio file for player functionality testing',
'audio_url' => '/audio_files/test_sample_2.wav',
'status' => 'complete'
],
[
'task_id' => 'test_audio_003',
'title' => 'Test Audio Sample 3',
'prompt' => 'Third test audio file for player functionality testing',
'audio_url' => '/audio_files/test_sample_3.m4a',
'status' => 'complete'
]
];
foreach ($testTracks as $track) {
// Check if track already exists
$stmt = $pdo->prepare("SELECT id FROM music_tracks WHERE task_id = ?");
$stmt->execute([$track['task_id']]);
$existing = $stmt->fetch();
if (!$existing) {
// Insert test track
$stmt = $pdo->prepare("
INSERT INTO music_tracks (user_id, task_id, title, prompt, music_type, status, audio_url, duration, created_at)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, NOW())
");
$result = $stmt->execute([
1, // Default user ID
$track['task_id'],
$track['title'],
$track['prompt'],
'music',
$track['status'],
$track['audio_url'],
30
]);
if ($result) {
echo "ā
Created test track: " . $track['title'] . "\n";
} else {
echo "ā Failed to create test track: " . $track['title'] . "\n";
}
} else {
echo "ā ļø Test track exists: " . $track['title'] . "\n";
}
}
} else {
echo "ā Database connection failed\n";
}
echo "\nšÆ TESTING STEPS:\n";
echo "1. Visit: https://soundstudiopro.com/test_player_functionality.php\n";
echo "2. Run all the player component tests\n";
echo "3. Test with sample audio files\n";
echo "4. Verify browser compatibility\n";
echo "5. Check error handling\n\n";
echo "š EXPECTED RESULTS:\n";
echo "ā
Basic audio playback should work\n";
echo "ā
Player controls should function\n";
echo "ā
Progress bar should update\n";
echo "ā
Volume control should work\n";
echo "ā
Error handling should catch issues\n";
echo "ā
Browser should support audio formats\n\n";
echo "š§ NEXT STEPS:\n";
echo "1. If all tests pass, the player is ready for API integration\n";
echo "2. If tests fail, we need to fix the player before proceeding\n";
echo "3. Use the test results to identify any browser compatibility issues\n";
echo "4. Ensure error handling works for failed audio loads\n\n";
echo "š TEST AUDIO FILES CREATED!\n";
echo "ā
Ready for player functionality testing\n";
echo "ā
Database entries created for testing\n";
echo "ā
All test infrastructure in place\n";
?>