Skip to content

feat(player): migrate from ExoPlayer 2.18.7 to media3 1.10.1#45

Open
Priveetee wants to merge 6 commits into
InfinityLoop1308:devfrom
Priveetee:feat/media3-migration
Open

feat(player): migrate from ExoPlayer 2.18.7 to media3 1.10.1#45
Priveetee wants to merge 6 commits into
InfinityLoop1308:devfrom
Priveetee:feat/media3-migration

Conversation

@Priveetee
Copy link
Copy Markdown
Contributor

@Priveetee Priveetee commented Jun 5, 2026

Migrates the player off ExoPlayer 2.18.7 (EOL/archived) to media3 1.10.1. Independent of SABR, it migrates the whole player (niconico, BiliBili, YouTube non-SABR, everything), so it's its own PR. Tracking: #42.

Related:

Summary

Swaps the player stack from com.google.android.exoplayer2.* to androidx.media3.*. The only non-mechanical parts are the media session (media3 has no MediaSessionConnector) and the custom HttpDataSources (media3 made the ctor private).

Changes

  • deps: ExoPlayer 2.18.7 -> media3 1.10.1.
  • package move com.google.android.exoplayer2.* -> androidx.media3.* across renderers, resolvers, media sources, mediaitem tags, player and helpers.
  • rewrite the media session glue by hand (MediaSessionCompat.Callback + media3 Player.Listener), fold in the queue navigator, drop PlayQueueNavigator.
  • convert PurifiedHttpDataSource / NiconicoLiveHttpDataSource to delegation (wrap an inner DefaultHttpDataSource).
  • vendor the exo_icon_* / exo_media_action_* drawables the media3-ui AAR no longer ships.
  • adapt the media3 1.10 API breaks: DefaultLoadControl (each buffer split into a normal + a ForLocalPlayback value, same value used for both), ChunkSampleStream (new handleInitialDiscontinuity / firstChunkStartTimeUs / downloadExecutor args), DefaultHlsPlaylistTracker factory signature.
  • minSdk 21 -> 23.

Why

ExoPlayer 2 is archived and gets no fixes; media3 is the maintained successor and unblocks newer player work.

Impact / Compatibility

Impact's not that big i think, it's mostly a repackage of the same engine:

  • media3 is the new home of ExoPlayer (androidx.media3.exoplayer.ExoPlayer); com.google.android.exoplayer2 is discontinued. Same player engine, not a new one. (migration guide)
  • the bulk is a documented 1:1 package/class rename (ExoPlayer 2.19.1 was the last standalone release). (class/package mappings)
  • minSdk 21 -> 23: media3-session 1.9+ needs 23, so this drops Android 5.0/5.1. Heads-up since it's the one real compat call here (1.8.1 is the last minSdk-21 line if we'd rather hold on 23).
  • media session stays backwards compatible: kept MediaSessionCompat, so media-compat clients (Android Auto, MediaControllerCompat) keep working, which media3 explicitly supports.

Validation

  • JAVA_HOME=<jdk25> ./gradlew :app:assembleDebug
  • Installed debug APK on Pixel 8 and tested on emulator, on media3 1.10.1.
  • YouTube playback (HLS/DASH), notification + lockscreen controls (play/pause/next/prev), background + popup player all work through the new manual media session.

Notes

  • Big diff but mostly mechanical import swaps; split into per-scope commits (build / drawables / session / datasources / imports) to keep review sane.
  • Not ready to merge yet, still a bunch of testing i want to run (more devices + services) before this is good to go.

@Priveetee
Copy link
Copy Markdown
Contributor Author

sorry, mixed up my git on this one :p the branch had dragged in the SABR PoC commits so the diff was a mess. force-pushed a clean one, it's media3-only now (no SABR files), should be sorted :) lmk if anything's off

@InfinityLoop1308
Copy link
Copy Markdown
Owner

Looks good. I'm considering a more aggressive refactor for #46, but it's pretty uncertain right now.

@Priveetee
Copy link
Copy Markdown
Contributor Author

lmaooo no way 😭 we both went media3 at the exact same time, what are the odds

okay i'm 100% following your lead on #46, killing the player + VideoDetailFragment tech debt properly beats just repackaging the old player. #45 can stay as the fallback if codex doesn't get it there.

sabr doesn't care which player wins anyway: the extractor (InfinityLoop1308/PipePipeExtractor#69) is player-agnostic and the client side is just media3 DataSources, so i'll wire it onto whichever one lands. lmk :)

@InfinityLoop1308
Copy link
Copy Markdown
Owner

i'll continue go with this pr since #46 is proved to be too aggressive.

@InfinityLoop1308
Copy link
Copy Markdown
Owner

btw, is there some any specific reason for using 1.4.1?

@Priveetee
Copy link
Copy Markdown
Contributor Author

no real reason behind 1.4.1, it's literally just what came up when i googled media3, copy pasted it and moved on 😅 nothing tied to it, so i'll bump it to a current stable (probably 1.10.1) and make sure nothing breaks.

and if you wanna work on this branch or take it further yourself, go for it, no problem at all, the history's all there so it's totally fine by me :) if not no worries, we're used to it by now anyway

honestly between codex rewriting half the app and me getting bullied by a decoder, not sure who's been rougher on this repo this week 😂

@Priveetee
Copy link
Copy Markdown
Contributor Author

@InfinityLoop1308 bumped it to 1.10.1. one heads-up: media3 1.9+ raised its own minSdk to 23 (media3-session), so anything past 1.8.x forces our app minSdk from 21 -> 23, dropping android 5.0/5.1 (api 21/22).

i went with 1.10.1 + minSdk 23 (that share is tiny now and the newer framework is worth it), but the compat call is yours. if you'd rather keep api 21 i can pin to 1.8.1 instead, which is the last media3 that still supports minSdk 21.

@Priveetee Priveetee force-pushed the feat/media3-migration branch from 4d6406f to b54c87f Compare June 6, 2026 09:03
@Priveetee Priveetee changed the title feat(player): migrate from ExoPlayer 2.18.7 to media3 1.4.1 feat(player): migrate from ExoPlayer 2.18.7 to media3 1.10.1 Jun 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants