![]() 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/public_html/ |
# 🔍 GLOBAL PLAYER & COMMUNITY_FIXED AUDIO DEBUGGING GUIDE
**Date:** December 12, 2025
**Status:** ENHANCED ERROR LOGGING ADDED
---
## ✅ ENHANCEMENTS ADDED
### Enhanced Error Logging
**File:** `global_player.php`
**Change:** Added detailed error logging for audio loading failures
**New Features:**
- Detailed error codes and messages
- Network state logging
- Source URL logging
- Token validation error detection
---
## 🔍 HOW TO DEBUG
### Step 1: Open Browser Console
1. Go to `/community_fixed.php`
2. Press **F12** to open Developer Tools
3. Click on **Console** tab
### Step 2: Try to Play a Track
1. Click play button on any track
2. Watch the console for messages
### Step 3: Check for Errors
**Look for these messages:**
✅ **Good signs:**
- `🎵 Global Player playTrack called:`
- `🎵 Setting audio source:`
- `🎵 Playback started successfully`
❌ **Bad signs:**
- `❌ Global player not available`
- `❌ playTrack returned false`
- `🎵 Audio error:`
- `🎵 Audio loading error detected:`
- `🎵 Failed to load audio URL:`
### Step 4: Check Network Tab
1. Click on **Network** tab
2. Filter by "play_audio"
3. Try to play a track
4. Look for the request to `/utils/play_audio.php`
**Check:**
- **Status Code:** Should be `200`, not `403` or `404`
- **Response:** Should be audio data, not error message
- **Request URL:** Should include `?id=X&token=Y&expires=Z`
---
## 🚨 COMMON ERRORS & FIXES
### Error: "Global player not available"
**Symptoms:**
- Console shows: `❌ Global player not available`
- Alert: "Player not ready. Please refresh."
**Possible Causes:**
1. `global_player.php` not loaded
2. Player not initialized
3. Timing issue (player not ready)
**Fix:**
- Check if `includes/footer.php` includes `global_player.php`
- Check browser console for initialization errors
- Try refreshing the page
### Error: "playTrack returned false"
**Symptoms:**
- Console shows: `❌ playTrack returned false`
- Alert: "Failed to play track."
**Possible Causes:**
1. Invalid audio URL (NULL, empty, or malformed)
2. Audio element failed to load
3. Token validation failed
**Fix:**
- Check `data-audio-url` attribute on play button
- Check network tab for failed requests
- Verify token is in URL
### Error: "Audio loading error detected"
**Symptoms:**
- Console shows: `🎵 Audio loading error detected:`
- Network state: `3` (NETWORK_NO_SOURCE)
- Ready state: `0` (HAVE_NOTHING)
**Possible Causes:**
1. **403 Forbidden:** Token validation failed
2. **404 Not Found:** Track doesn't exist
3. **CORS Error:** Cross-origin request blocked
4. **Network Error:** Server unreachable
**Fix:**
- Check network tab for response code
- Verify token is valid and not expired
- Check if track exists in database
- Check CORS headers
### Error: "MEDIA_ERR_NETWORK"
**Symptoms:**
- Error code: `2`
- Message: "Network error"
**Possible Causes:**
1. Server returned error (403, 404, 500)
2. Network timeout
3. CORS blocked
**Fix:**
- Check network tab for actual HTTP response
- Verify server is responding
- Check CORS configuration
### Error: "MEDIA_ERR_SRC_NOT_SUPPORTED"
**Symptoms:**
- Error code: `4`
- Message: "Source not supported"
**Possible Causes:**
1. Invalid audio URL format
2. Server returning HTML instead of audio
3. Wrong content-type header
**Fix:**
- Check network tab - response should be audio, not HTML
- Verify `Content-Type: audio/mpeg` header
- Check if URL is correct format
---
## 📋 DEBUGGING CHECKLIST
- [ ] Browser console open (F12)
- [ ] Network tab open
- [ ] Click play button
- [ ] Check console for `🎵` messages
- [ ] Check console for `❌` errors
- [ ] Check network tab for `/utils/play_audio.php` request
- [ ] Verify request has token parameters
- [ ] Check response code (should be 200)
- [ ] Check response type (should be audio)
- [ ] Verify audio URL format is correct
---
## 🔧 QUICK TESTS
### Test 1: Check Audio URL
**In browser console:**
```javascript
document.querySelector('.play-btn').getAttribute('data-audio-url')
```
**Expected:** `/utils/play_audio.php?id=123&token=abc&expires=1234567890`
### Test 2: Check Global Player
**In browser console:**
```javascript
console.log('Player:', window.enhancedGlobalPlayer);
console.log('PlayTrack:', typeof window.enhancedGlobalPlayer?.playTrack);
```
**Expected:** Should show player object and function
### Test 3: Manual Play Test
**In browser console:**
```javascript
window.enhancedGlobalPlayer.playTrack(
'/utils/play_audio.php?id=123&token=abc&expires=1234567890',
'Test Track',
'Test Artist',
123
);
```
**Expected:** Should start playing (if token is valid)
---
## 📊 WHAT TO REPORT
If music still doesn't play, please provide:
1. **Browser console output:**
- Copy all `🎵` and `❌` messages
- Copy any error messages
2. **Network tab output:**
- Screenshot of `/utils/play_audio.php` request
- Response code
- Response headers
- Response preview (first few lines)
3. **Audio URL:**
- Copy the `data-audio-url` value from play button
4. **Browser info:**
- Browser name and version
- Operating system
---
**Status:** ✅ **ENHANCED ERROR LOGGING ADDED**
The global player now has much better error logging. Check the browser console to see exactly what's failing!