How teamnewpipe/newpipe works
1. Overall shape
- This repository is a multi-target NewPipe codebase: a mature Android app in app/, a newer Kotlin Multiplatform shared UI/core layer in shared/, plus thin desktop and iOS hosts in desktopApp/ and iosApp/.
- For an architecture diagram, treat the Android app as the feature-complete production path, and the shared module as the refactor/new frontend foundation.
2. Primary architectural boundary: UI vs. media/service logic
- The app is a streaming front-end, so its core boundary is between presentation and service-specific extraction/playback logic.
- The repository itself contains the app-side orchestration, but the actual media scraping/parsing is delegated to the external NewPipe Extractor library, as described in the README.
- That means the app does not own provider APIs directly; it consumes normalized metadata and stream information from the extractor boundary.
3. Legacy Android presentation layer
- app/src/main/java/org/schabi/newpipe/ is organized around classic Android UI entry points: MainActivity, RouterActivity, SettingsActivity, player activities, dialogs, and many fragments.
- Most feature screens live under fragments/, local/, player/, settings/, and download/.
- The UI is largely fragment-driven and RecyclerView-based, with custom view/holder classes under info_list/, local/holder/, and views/.
4. Cross-platform shared layer
- shared/ uses Compose, Koin, and platform-specific entrypoints (ComposeActivity on Android, MainViewController on iOS).
- It contains common navigation, theme, and settings DI modules, suggesting a future architecture where the UI is shared across platforms while platform hosts remain thin.
- This is a separate boundary from the legacy Android app; diagrammatically, it should be shown as a parallel frontend stack, not as a direct replacement already wired through every feature.
5. Content browsing and remote data flow
- Remote content flows from extractor-backed service queries into browse/search fragments such as SearchFragment, ChannelFragment, PlaylistFragment, CommentsFragment, and RelatedItemsFragment.
- The app normalizes service results into item models and adapters (info_list, util/StreamItemAdapter, LocalItemBuilder, etc.) before rendering.
- Supported upstream services explicitly include YouTube, PeerTube, Bandcamp, SoundCloud, and media.ccc.de.
6. Playback subsystem
- The player is a major subsystem under player/, centered around Player, PlayerService, PlayQueue, MediaSourceManager, and UI variants (MainPlayerUi, PopupPlayerUi, BackgroundPlayerUi, VideoPlayerUi).
- It uses custom data source and renderer helpers, plus play queue abstractions and media session/notification integration.
- Architecture-wise, this is a service-backed playback pipeline: extracted stream info is converted into managed media sources, played in a foreground/background service, and mirrored to UI, notifications, and media session controls.
7. Download subsystem
- Downloads are handled by the download/ UI plus the embedded us.shandian.giga package, which contains the actual download manager, missions, post-processing, and storage helpers.
- This is a distinct pipeline from playback: user actions create a download mission, the service manages it, and post-processing converts or muxes formats when needed.
- The presence of SAF-aware file helpers and postprocessing readers/writers indicates downloads are filesystem-centric and can target device storage without relying on Google services.
8. Local persistence
- Persistent app state is centered on Room in database/, with entities/DAOs for feeds, history, playlists, streams, and subscriptions.
- AppDatabase, migration definitions, and the checked-in schemas/ directory make database evolution a first-class architectural concern.
- This storage layer underpins subscriptions, feed state, watch history, and local playlists, which are all core user data flows.
9. Subscriptions, feeds, history, playlists
- These are separate but related feature subsystems under local/:
- subscription/ manages subscribed channels and groups.
- feed/ builds aggregated feed state and notifications.
- history/ records watched/search activity.
- playlist/ manages local playlists and export/share behavior.
- Data typically flows from extractor results into the corresponding manager, then into Room, and back into list fragments/view models for display.
10. Settings, backup, and migration
- settings/ is a large subsystem with dedicated fragments for appearance, content, downloads, notifications, player settings, updates, and debug options.
- It also includes import/export and migration utilities, which are important because the app stores both preference state and database state across versions.
- For a diagram, this is the control plane for app behavior: configuration affects playback, downloads, notifications, tabs, and feature visibility.
11. Error handling and crash/reporting path
- error/ contains dedicated error UI plus ACRA reporting integration.
- There are specialized activities for error display and reCAPTCHA handling, implying service failures can surface as interactive recovery flows rather than simple dialogs.
- This subsystem sits across UI and networking boundaries because it mediates user-visible failures from extractor, playback, or service access.
12. Update and background work
- NewVersionWorker and the notification/feed worker classes show background jobs managed separately from foreground screens.
- This includes update checks, feed refreshes, and scheduled notifications.
- The architecture is therefore not purely event-driven in the UI; it has background orchestration for periodic or deferred tasks.
13. Tooling and delivery
- The repo is built with Gradle Kotlin DSL, includes extensive Android tests and unit tests, and uses GitHub Actions for CI, release APK builds, and image minimization.
- fastlane/metadata and doc/ indicate app-store-style release packaging and multilingual distribution metadata.
- app/schemas plus migration tests show a deliberate emphasis on reproducible database upgrades across releases.
14. What to draw as the main boundaries
- The most accurate diagram would show:
- Frontend surfaces: legacy Android UI, shared Compose UI, desktop/iOS hosts.
- App services: playback, downloads, subscriptions/feed/history/playlists, settings.
- Persistence: Room DB and preferences/export files.
- External dependencies: NewPipe Extractor, upstream media services, filesystem/SAF, notification/media session system, and crash reporting.
- The key flows are: user interaction → feature manager/view model → extractor or local DB → UI update; plus background worker/service flows for playback, downloads, feeds, and updates.
Main entry points: App.kt Shared app · AppDatabase.kt Local state · player Player core · list Browse screens
Components 28
Android app
Legacy production Android application with fragment-based UI and app services.
- App entry · Android application entry and legacy top-level activities.
app/src/main/java/org/schabi/newpipe/App.kt - Legacy UI · Fragment-driven Android screens, activities, dialogs, and custom list views.
app/src/main/java/org/schabi/newpipe/fragments - Browse screens · Search, channel, playlist, comments, related-items, and kiosk browsing flows.
app/src/main/java/org/schabi/newpipe/fragments/list - Info renderers · Normalizes extractor results into list items, holders, and dialogs for display.
app/src/main/java/org/schabi/newpipe/info_list
Shared KMP
Cross-platform Compose foundation reused by Android, iOS, and desktop hosts.
- Shared app · Shared Compose application shell with navigation, theme, and DI.
shared/src/commonMain/kotlin/net/newpipe/app/App.kt - Shared nav · Shared screen model and navigation display for the new frontend stack.
shared/src/commonMain/kotlin/net/newpipe/app/navigation - Shared theme · Shared service-aware theming and preview resources.
shared/src/commonMain/kotlin/net/newpipe/app/theme - Compose host · Android entrypoint for the shared Compose application.
shared/src/androidMain/kotlin/net/newpipe/app/ComposeActivity.kt
Host shells
Thin desktop and iOS entrypoints around the shared layer.
- iOS host · iOS view controller entrypoint for the shared Compose application.
shared/src/iosMain/kotlin/net/newpipe/app/MainViewController.kt - Desktop host · Desktop JVM launcher around the shared application.
desktopApp/src/main/kotlin/net/newpipe/app/Main.kt
Core services
Playback, downloads, local state, settings, and background orchestration.
- Player core · Foreground/background playback pipeline with queue, source management, and session hooks.
app/src/main/java/org/schabi/newpipe/player - Player UIs · Main, popup, background, and video player interfaces backed by the player service.
app/src/main/java/org/schabi/newpipe/player/ui - Play queue · Queue abstractions and adapters for ordered playback across media items.
app/src/main/java/org/schabi/newpipe/player/playqueue - Source manager · Converts extracted stream info into managed media sources and playback-ready inputs.
app/src/main/java/org/schabi/newpipe/player/playback/MediaSourceManager.java - Download UI · Download dialogs and activity entrypoints for user-initiated downloads.
app/src/main/java/org/schabi/newpipe/download - Download manager · Mission-based download execution, recovery, service control, and post-processing.
app/src/main/java/us/shandian/giga/service/DownloadManagerService.java - Local state · Room database, entities, DAOs, migrations, and schema tracking for app data.
app/src/main/java/org/schabi/newpipe/database/AppDatabase.kt - Subscriptions · Subscribed channels and feed-group management.
app/src/main/java/org/schabi/newpipe/local/subscription/SubscriptionManager.kt - Feed system · Feed aggregation, state tracking, notifications, and background loading.
app/src/main/java/org/schabi/newpipe/local/feed - History · Watch and search history recording and related statistics views.
app/src/main/java/org/schabi/newpipe/local/history/HistoryRecordManager.java - Playlists · Local and remote playlist management plus export/share flows.
app/src/main/java/org/schabi/newpipe/local/playlist - Settings · Appearance, content, downloads, player, notifications, updates, import/export, and migrations.
app/src/main/java/org/schabi/newpipe/settings - Error flow · Error presentation, recaptcha handling, and crash reporting integration.
app/src/main/java/org/schabi/newpipe/error - Background work · Update checks, feed refreshes, notification jobs, and other deferred work.
app/src/main/java/org/schabi/newpipe/NewVersionWorker.kt
External systems
Extractor, upstream services, storage, and platform integrations.
- Extractor · External media extraction library providing normalized metadata and stream info.
- Upstream services · Supported content services such as YouTube, PeerTube, Bandcamp, SoundCloud, and media.ccc.de.
- Platform systems · Filesystem, SAF, notifications, media session, and Android background execution.
- Crash reporting · ACRA-based crash and error reporting path.
Connections 28
- App entry → Legacy UI: starts · Bootstraps the legacy Android shell and feature screens.
- Legacy UI → Browse screens: opens · Routes user navigation into browsing and detail fragments.
- Browse screens → Info renderers: renders via · Turns extractor results into adapters, holders, and dialogs.
- Browse screens → Extractor: queries · Requests normalized content and stream metadata.
- Info renderers → Extractor: adapts data from · Consumes extractor output and item models.
- Player core → Play queue: uses · Maintains ordered playback state.
- Player core → Source manager: builds · Converts stream info into managed media sources.
- Player UIs → Player core: controls · Mirrors player state and user actions.
- Player core → Platform systems: integrates with · Uses media session, notifications, and playback/runtime APIs.
- Download UI → Download manager: starts missions · Creates and monitors download jobs.
- Download manager → Platform systems: writes files · Uses filesystem and SAF-aware storage helpers.
- Subscriptions → Local state: persists · Stores subscription and feed-group data.
- Feed system → Local state: reads/writes · Maintains feed state in Room.
- History → Local state: persists · Records stream and search history.
- Playlists → Local state: persists · Stores playlist metadata and stream membership.
- Settings → Local state: imports/exports · Moves preference and database state across versions.
- Settings → Platform systems: configures · Influences notifications, updates, storage, and UI behavior.
- Error flow → Crash reporting: reports to · Sends crash diagnostics through ACRA.
- Error flow → Extractor: handles failures from · Surfaces extractor and service errors to the user.
- Background work → Feed system: refreshes · Runs deferred feed loading and notifications.
- Background work → Platform systems: scheduled by · Uses background execution and system scheduling.
- Shared app → Shared nav: contains · Composes navigation and screen flow.
- Shared app → Shared theme: styles with · Applies shared theme and service-aware colors.
- Compose host → Shared app: hosts · Android host for the shared Compose app.
- iOS host → Shared app: hosts · iOS host for the shared Compose app.
- Desktop host → Shared app: hosts · Desktop JVM host for the shared Compose app.
- Shared app → Settings: shares DI with · Uses shared settings module and Koin wiring.
- Extractor → Upstream services: fetches from · Scrapes service-specific content and streams.