- Full PWA support with offline capabilities - Comprehensive search across songs, playlists, and channels - Offline playlist manager with download tracking - Pre-built frontend for zero-build deployment - Docker-based deployment with docker compose - Material-UI dark theme interface - YouTube audio download and management - Multi-user authentication support
3.3 KiB
3.3 KiB
🚀 Quick Start: Offline Playlists
For Users
Download Playlist for Offline Use:
- Navigate to any playlist
- Scroll to "Cache for Offline" card
- Tap "Make Available Offline"
- Wait for download to complete
- Green checkmark = Ready! 🎉
Play Offline:
- Enable airplane mode
- Open SoundWave
- Navigate to cached playlist
- Tap Play - Works instantly! 📱
Manage Storage:
- Tap "Offline" in sidebar (PWA badge)
- View all cached playlists
- Remove individual playlists or clear all
- See storage usage at a glance
For Developers
Check if Playlist is Cached:
import { offlineStorage } from '../utils/offlineStorage';
const playlist = await offlineStorage.getPlaylist(id);
if (playlist?.offline) {
console.log('Available offline!');
}
Cache a Playlist:
import { usePWA } from '../context/PWAContext';
const { cachePlaylist } = usePWA();
const audioUrls = tracks.map(t => `/api/audio/${t.youtube_id}/download/`);
await cachePlaylist(playlistId, audioUrls);
await offlineStorage.savePlaylist({...playlist, offline: true});
Remove from Cache:
const { removePlaylistCache } = usePWA();
await removePlaylistCache(playlistId, audioUrls);
await offlineStorage.removePlaylist(id);
New Routes
/offline- Offline storage management page- All existing routes unchanged
Security ✅
- ✅ Authentication required for all endpoints
- ✅ User isolation enforced (owner-based filtering)
- ✅ No cross-user data access
- ✅ Service Worker respects authentication
- ✅ No route conflicts
Testing
Online:
# Navigate to playlist, click "Make Available Offline"
# Check sidebar badge shows "Offline" menu
# Visit /offline to see cached playlists
Offline:
# Enable airplane mode in browser DevTools
# Navigate to cached playlist
# Verify playback works
# Check offline warning appears for uncached content
Browser DevTools Testing
Service Worker:
Application → Service Workers → soundwave-v1 (Active)
Cache Storage:
Application → Cache Storage
- soundwave-audio-v1 (audio files)
- soundwave-api-v1 (API responses)
IndexedDB:
Application → IndexedDB → soundwave-offline
- playlists (cached metadata)
Storage Limits
- Desktop: ~50% of available disk space
- Mobile: ~50% of available storage
- Minimum: 10 MB per origin
- Typical: Several GB available
Known Behaviors
- Storage is per-browser - Not synced across devices
- Caching requires network - Must be online to download
- Authentication required - Token must be valid
- Browser may evict - On low storage, browser clears cache
- HTTPS required - Service Workers need secure context
Files Changed
New:
frontend/src/pages/OfflineManagerPage.tsxdocs/OFFLINE_FEATURE_COMPLETE.md
Modified:
frontend/src/pages/PlaylistDetailPage.tsxfrontend/src/pages/PlaylistsPage.tsxfrontend/src/App.tsxfrontend/src/components/Sidebar.tsxfrontend/public/service-worker.js
No Breaking Changes
✅ All existing features work as before
✅ Backward compatible
✅ Progressive enhancement
✅ Graceful degradation
Ready to use! 🎉