How libre-tube/libretube works
LibreTube is a privacy-focused Android YouTube client. The principal workflow is: a user searches or opens a shared link, the UI requests content through a media repository, displays results, and starts online playback; playback can persist history and positions. Downloads follow a separate enqueue-and-transfer path, while subscriptions, playlists, accounts, synchronization, and privacy-oriented integrations extend the same data layer. Several repository implementations are represented from the tree, but their internal call details were not sampled, so uncertain links are omitted.
Main entry points: OnlinePlayerService.kt Online Player · MediaServiceRepository.kt Media Repository · SearchResultFragment.kt Search Results · DownloadService.kt Download Service
Components 25
UI and Navigation
- Share Router
app/src/main/java/com/github/libretube/ui/activities/RouterActivity.kt - Main Activity
app/src/main/java/com/github/libretube/ui/activities/MainActivity.kt - Search Results
app/src/main/java/com/github/libretube/ui/fragments/SearchResultFragment.kt - Search ViewModel
app/src/main/java/com/github/libretube/ui/models/SearchResultViewModel.kt - Player Gestures
app/src/main/java/com/github/libretube/ui/listeners/PlayerGestureController.kt
Content and APIs
- Media Repository
app/src/main/java/com/github/libretube/api/MediaServiceRepository.kt - NewPipe Repository
app/src/main/java/com/github/libretube/api/NewPipeMediaServiceRepository.kt - Piped Repository
app/src/main/java/com/github/libretube/api/PipedMediaServiceRepository.kt
Playback and Downloads
- Player Service
app/src/main/java/com/github/libretube/services/AbstractPlayerService.kt - Online Player
app/src/main/java/com/github/libretube/services/OnlinePlayerService.kt - Media3 Player
- Download Service
app/src/main/java/com/github/libretube/services/DownloadService.kt - Playlist Enqueuer
app/src/main/java/com/github/libretube/services/PlaylistDownloadEnqueueService.kt - Download Providers
app/src/main/java/com/github/libretube/repo/DownloadProvider.kt
State and Sync
- Local Database
app/src/main/java/com/github/libretube/db/AppDatabase.kt - Local User Data
app/src/main/java/com/github/libretube/repo/LocalUserDataRepository.kt - Piped User Data
app/src/main/java/com/github/libretube/repo/PipedUserDataRepository.kt - Sync User Data
app/src/main/java/com/github/libretube/repo/LibreTubeSyncServerUserDataRepository.kt
Other components
- App User
- YouTube Service
- Piped Service
- SponsorBlock
- DeArrow
- Dislike Service
- Sync Server
Connections 25
- App User → Share Router: shares link
- Share Router → Main Activity: routes
- Main Activity → Search Results: opens
- Search Results → Search ViewModel: collects results
- Search ViewModel → Media Repository: requests search
- Media Repository → NewPipe Repository: delegates
- NewPipe Repository → YouTube Service: extracts content
- Media Repository → Piped Repository: selects backend
- Piped Repository → Piped Service: requests content
- Search Results → App User: shows results
- Player Gestures → Player Service: sends commands
- Player Service → Online Player: starts playback
- Online Player → Media Repository: loads streams
- Online Player → Media3 Player: sets source
- Online Player → Local User Data: records history
- Online Player → SponsorBlock: loads segments
- Online Player → DeArrow: loads metadata
- Online Player → Dislike Service: loads ratings
- Playlist Enqueuer → Media Repository: gets streams
- Playlist Enqueuer → Download Service: starts downloads
- Download Service → Local Database: stores metadata
- Download Service → Download Providers: downloads media
- Local User Data → Local Database: reads and writes
- Piped User Data → Piped Service: syncs account
- Sync User Data → Sync Server: syncs data