Migrating from ExoPlayer 2 to Media3: A Fun & Practical Guide
Why Migrate? (Besides Google Telling You To😜)
Google has spoken—ExoPlayer 2 is old news, and Media3 is the new standard for Android media playback. It’s modular,
Jetpack-aligned, and designed for the long haul. If your app still relies on ExoPlayer 2, this migration ensures modern API design, better lifecycle handling, and compatibility with Android’s latest updates. Plus, who doesn’t love a fresh start?
Let’s dive into the key changes and how to migrate with minimal headaches (and maximum fun).
Major Changes in Media3 (What You Need to Know)
1. Package Reshuffle: Out with the Old, In with the New🔄
Your ExoPlayer 2 imports:
![]() |
Now become Media3 imports:
![]() Media 3 imports |
Yep, SimpleExoPlayer is now just ExoPlayer. Simple, right? 😆
2. Player Initialization (Same, But Shinier✨)
ExoPlayer 2:

Player Initialization Exoplayer
Media3:

Player Initialization Media 3
If you were expecting something earth-shattering, sorry. But hey, at least it’s cleaner!
3. Setting Up Media Items (A Tiny Bit Different)
Before:

Setting up Media Item Exoplayer 2
Now:

Setting up Media Item Media 3
Now you get to use a Builder, which makes it easier to expand media item configurations.
4. MediaSession and MediaController (Because Your App Deserves System Controls)
Instead of MediaSessionConnector, use MediaSession:

Use Media Session in Media 3
Want playback controls? 🕹️

Use Media Controller in Media 3
More modern, more Jetpack-y. 🏎️
5. UI Components (Yes, You Need to Update Your XML)
If your XML looks like this:

Exoplayer 2 Player VIew
Change it to this:

Media 3 Player VIew
Not a huge deal, but forget this and your UI won’t be happy. 😅
6. Event Handling (No More EventListener )
If you were using EventListener, update to Listener:

EventListener, update to Listener:
It’s cleaner, and it works just the same. 🧼
7. Subtitles (Now More Elegant )
Subtitle setup in ExoPlayer 2:

Subtitle setup in ExoPlayer 2:
In Media3, just update the MIME type to MimeTypes.TEXT_VTT for better compatibility. 🎥
8. @UnstableApi (Handle With Care! )
Some APIs are now marked @UnstableApi, meaning Google might break them in a future update.

@UnstableApi usage
9. Dependency Updates (Don’t Forget These! 🛠️)
Make sure your build.gradle includes:

Media 3 Dependencies
Without this, your app won’t build, and you’ll spend hours wondering why. ⏳💀
Final Thoughts (Aka TL;DR )
- Update your package imports (com.google.android.exoplayer2 → androidx.media3)
- SimpleExoPlayer is now just ExoPlayer (because simpler is better)
- Media3 uses Builders for MediaItem
- MediaSessionConnector is gone; use MediaSession
- PlayerView XML needs updating
- No more exo_fullscreen, so DIY your fullscreen handling
- Watch out for @UnstableApi warnings
- Update your dependencies, or nothing will work. Migrating to Media3 is mostly straightforward—just a few package changes, some updated APIs,
and a couple of missing features you’ll need to reimplement. But overall, it’s a cleaner, more
future-proof way to handle media playback in Android.
References 📚
- Media3 API Mappings
- ExoPlayer to Media3 Migration Guide
Happy coding, and may your app never buffer!