Download System Architecture
Downloads are managed by the Orpheus native module, providing robust and efficient background downloading.Core Features
Background Downloads
Background Downloads
- Continue downloading even when app is closed
- Automatic retry on network failures
- Resume support for interrupted downloads
- Download queue with concurrent task management
Metadata Preservation
Metadata Preservation
Downloaded files include:
- Track title and artist
- Album artwork
- Duration and bitrate
- Source information (BVID, CID)
- Custom metadata for BBPlayer
Storage Management
Storage Management
- Efficient file organization
- Automatic cleanup of incomplete downloads
- Storage space monitoring
- Duplicate detection
Starting a Download
Download individual tracks or entire playlists directly from the app.Download Single Track
Access Track Menu
From any track list (playlist, search results, etc.), tap the three-dot menu next to the track.
Select Download
Choose “下载” (Download) from the menu. The track is added to the download queue immediately.
Download Playlist
Select Download All
Choose “下载全部” (Download All). BBPlayer will:
- Validate all tracks are available
- Add them to the download queue
- Start downloading concurrently
Download Manager
The download manager (apps/mobile/src/app/download.tsx) provides comprehensive control over active and completed downloads.
Active Downloads View
Monitor in-progress downloads with real-time updates:- Download States
- Progress Information
- Task Actions
Each download task can be in one of several states:
- Pending: Queued, waiting to start
- Downloading: Actively downloading
- Paused: Manually paused by user
- Failed: Download error occurred
- Completed: Successfully downloaded
Downloaded Content View
Access all completed downloads from the Downloaded screen:Downloaded tracks can be played without an internet connection and include all metadata for a seamless offline experience.
Download Management Actions
Offline Playback
Downloaded tracks are seamlessly integrated into the playback system.How It Works
Automatic Fallback
Automatic Fallback
When playing a track:
- Check if download exists locally
- If yes, use local file (no network required)
- If no, stream from Bilibili servers
Offline Detection
Offline Detection
BBPlayer detects offline status and:
- Automatically uses downloaded files
- Disables network-dependent features
- Shows offline indicator in UI
- Prevents streaming attempts
Metadata Availability
Metadata Availability
All track information is available offline:
- Title, artist, album
- Cover artwork (cached)
- Lyrics (if previously fetched)
- Duration and bitrate
Offline-Specific Features
- Offline playlists: Filter playlists to show only downloaded tracks
- Storage usage: View total space used by downloads
- Download queue: Pre-download playlists before going offline
Audio Export
Export downloaded audio files to external storage (Android only).Export Process
Select Tracks to Export
In the Downloaded screen:
- Tap Export icon to export all
- Or enter selection mode to export specific tracks
Choose Destination
Select a directory using the Android document picker:
BBPlayer uses Android’s Storage Access Framework (SAF) for secure, user-controlled file access.
Export Progress
A modal displays export progress:
- Files exported: X / Y
- Current file name
- Overall progress percentage
- Success/failure status per file
Export Modal Component
- Real-time progress updates
- Error handling per file
- Cancel operation support
- Success summary
Download Settings
Configure download behavior in Settings > General:Network Settings
- Download on Cellular
- Concurrent Downloads
- Auto-Retry
Control whether downloads can use mobile data:
- Enabled: Download over any connection
- Disabled: Wi-Fi only (recommended)
Audio Quality
BBPlayer downloads the highest quality audio available from Bilibili, typically 320kbps AAC or FLAC when available.
- Auto: Highest available quality
- High (320kbps): AAC 320kbps
- Medium (192kbps): AAC 192kbps
- Low (128kbps): AAC 128kbps (saves storage)
Storage Location
Downloads are stored in the app’s private cache directory:Files in cache may be cleared by the system when storage is low. For permanent storage, export files to external storage.
Download Queue Management
The download queue system manages concurrent downloads efficiently.Queue Behavior
Priority System
Priority System
Downloads are processed in order:
- User-initiated single downloads (highest priority)
- Manual queue additions
- Batch playlist downloads
Concurrency Control
Concurrency Control
Error Handling
Error Handling
Failed downloads:
- Remain in queue with error status
- Show error reason (network, unavailable, permission)
- Can be manually retried
- Auto-retry if enabled in settings
Clearing Failed Downloads
Quickly remove all failed tasks:Download API Reference
The Orpheus module provides programmatic download control:Start Download
Control Downloads
Query Downloads
Select Directory (Android)
Troubleshooting
Downloads Keep Failing
Check Network
- Verify internet connection
- Try switching between Wi-Fi and cellular
- Check if Bilibili is accessible
Download Stuck at 0%
- Kill and restart the app
- Remove and re-add the download
- Check if track is still available on Bilibili
- Verify audio URL hasn’t expired
Export Fails on Android
- Grant storage permission when prompted
- Ensure destination directory is writable
- Check available space on external storage
- Try selecting a different directory
Downloaded Files Not Playing
- Verify download completed successfully (100%)
- Check file integrity in download manager
- Re-download if file is corrupted
- Report issue with track BVID for investigation
High Storage Usage
Delete Unused Downloads
- Enter selection mode in Downloaded tab
- Select tracks to remove
- Tap delete to free up space
Performance Tips
Battery Optimization
On Android, disable battery optimization to prevent download interruption:- Go to Android Settings > Apps > BBPlayer
- Battery > Battery optimization
- Select “Don’t optimize”