3.3 KiB
3.3 KiB
SoundCloud-Optimized Shaka Player - Quick Start
What This Fork Does
Fixes two major SoundCloud playback issues:
- Random stalling/freezing - DRM tracks getting stuck mid-playback
- Wrong start times - Songs starting at incorrect position after pausing
How It Works
Multi-Stage Stall Recovery
When playback stalls, Shaka tries 3 recovery methods in sequence:
Stall detected
↓
[1] Skip forward 0.1s
↓ (wait 100ms)
[2] Pause/unpause
↓ (wait 100ms)
[3] Force buffer refresh (micro-seek)
↓
Resume playback
Faster Gap Detection
- Old: 0.1 second margin at buffer edges
- New: 0.05 second margin (50% faster)
- Result: Smoother transitions, less stuttering
Quick Build & Install
# 1. Build
cd C:\Users\RedLintu16\Documents\Shaka
python build/all.py
# 2. Install to CrossSound
.\copy-to-crosssound.ps1
# 3. Restart CrossSound and test!
What to Look For
Console Logs (Filter: [SC])
Good signs (recovery working):
[SC] Stall detected at 45.23 for 1.2s
[SC] Recovery 1/3: Seeking forward 0.1s
✓ Playback resumes automatically
Bad signs (need more work):
[SC] Stall detected at 45.23 for 5.0s
[SC] Recovery 1/3: Seeking forward 0.1s
[SC] Recovery 2/3: Pause/unpause
[SC] Recovery 3/3: Force buffer refresh
✗ Playback still stuck (rare - indicates deeper issue)
Before vs After
Before (vanilla Shaka):
- Stalls every ~10 minutes on DRM tracks
- Manual intervention required (pause/play)
- Next track sometimes starts at wrong time
After (this fork):
- Fewer stalls (better buffering tolerance)
- Automatic recovery (3-stage approach)
- More reliable timing on track changes
Configuration
The fork works with CrossSound's existing configuration:
File: SCSC/src/ui/app.js (line 518)
player.configure({
streaming: {
rebufferingGoal: 4, // Synergy with stall recovery
bufferingGoal: 20, // Large buffer = fewer stalls
stallEnabled: true, // ← Uses our enhanced recovery
stallThreshold: 1, // Detect stalls after 1s
stallSkip: 0.1, // ← Triggers Recovery 1/3
}
})
Files Modified
Only one file changed:
lib/media/gap_jumping_controller.js
- Lines 241: Gap detection margin (0.1s → 0.05s)
- Lines 338-365: Multi-stage stall recovery
- Lines 286-292: Enhanced logging
Reverting to Vanilla Shaka
# Restore backup (created by copy-to-crosssound.ps1)
cd C:\Users\RedLintu16\Documents\SCSC\node_modules\shaka-player\dist
cp shaka-player.compiled.js.backup-YYYYMMDD-HHMMSS shaka-player.compiled.js
Troubleshooting
Build fails
# Clean and retry
cd C:\Users\RedLintu16\Documents\Shaka
rm -r dist/
python build/all.py --force
No [SC] logs appearing
- Check CrossSound is using the forked file
- Look at
node_modules/shaka-player/dist/shaka-player.compiled.jssize - Forked version should be slightly larger (extra logging)
Still getting stalls
- Check network (DevTools → Network → Throttling)
- Verify DRM license isn't failing (separate issue)
- Monitor buffer levels (look for frequent rebuffering)
Next Steps
If stalls persist, Phase 2 improvements:
- Audio-optimized buffering
- Dynamic buffer scaling
- More aggressive prefetching
See SOUNDCLOUD_IMPROVEMENTS.md for roadmap.