{"id":71244,"date":"2025-03-31T22:20:36","date_gmt":"2025-03-31T16:50:36","guid":{"rendered":"https:\/\/www.tothenew.com\/blog\/?p=71244"},"modified":"2025-04-01T11:18:53","modified_gmt":"2025-04-01T05:48:53","slug":"migrating-from-exoplayer-2-to-media3-a-fun-practical-guide","status":"publish","type":"post","link":"https:\/\/www.tothenew.com\/blog\/migrating-from-exoplayer-2-to-media3-a-fun-practical-guide\/","title":{"rendered":"Migrating from ExoPlayer 2 to Media3: A Fun &#038; Practical Guide"},"content":{"rendered":"<h2><strong>Why Migrate? (Besides Google Telling You To\ud83d\ude1c)<\/strong><\/h2>\n<p>Google has spoken\u2014ExoPlayer 2 is old news, and Media3 is the new standard for Android media playback. It\u2019s modular,<\/p>\n<p>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\u2019s latest updates. Plus, who doesn\u2019t love a fresh start?<\/p>\n<p>Let\u2019s dive into the key changes and how to migrate with minimal headaches (and maximum fun).<\/p>\n<hr \/>\n<h2>Major Changes in Media3 (What You Need to Know)<\/h2>\n<h3>1. Package Reshuffle: Out with the Old, In with the New\ud83d\udd04<\/h3>\n<p>Your ExoPlayer 2 imports:<\/p>\n<table style=\"border-collapse: collapse; width: 58.6924%; height: 196px;\">\n<tbody>\n<tr style=\"height: 78px;\">\n<td style=\"width: 100%; text-align: left; height: 10px; padding-left: 40px;\"><img decoding=\"async\" loading=\"lazy\" class=\"size-large wp-image-71246\" src=\"https:\/\/www.tothenew.com\/blog\/wp-ttn-blog\/uploads\/2025\/03\/Screenshot-2025-03-28-at-9.15.28\u202fAM-1024x158.png\" alt=\"Exoplayer 2 imports\" width=\"625\" height=\"96\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2025\/03\/Screenshot-2025-03-28-at-9.15.28\u202fAM-1024x158.png 1024w, \/blog\/wp-ttn-blog\/uploads\/2025\/03\/Screenshot-2025-03-28-at-9.15.28\u202fAM-300x46.png 300w, \/blog\/wp-ttn-blog\/uploads\/2025\/03\/Screenshot-2025-03-28-at-9.15.28\u202fAM-768x119.png 768w, \/blog\/wp-ttn-blog\/uploads\/2025\/03\/Screenshot-2025-03-28-at-9.15.28\u202fAM-624x97.png 624w, \/blog\/wp-ttn-blog\/uploads\/2025\/03\/Screenshot-2025-03-28-at-9.15.28\u202fAM.png 1280w\" sizes=\"(max-width: 625px) 100vw, 625px\" \/><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Now become Media3 imports:<\/p>\n<table style=\"border-collapse: collapse; width: 26.1099%; height: 136px;\">\n<tbody>\n<tr>\n<td style=\"width: 100%; padding-left: 40px;\">\n<p><div id=\"attachment_71247\" style=\"width: 635px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-71247\" decoding=\"async\" loading=\"lazy\" class=\"size-large wp-image-71247\" src=\"https:\/\/www.tothenew.com\/blog\/wp-ttn-blog\/uploads\/2025\/03\/Screenshot-2025-03-28-at-9.20.22\u202fAM-1024x152.png\" alt=\"Media 3 imports\" width=\"625\" height=\"93\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2025\/03\/Screenshot-2025-03-28-at-9.20.22\u202fAM-1024x152.png 1024w, \/blog\/wp-ttn-blog\/uploads\/2025\/03\/Screenshot-2025-03-28-at-9.20.22\u202fAM-300x45.png 300w, \/blog\/wp-ttn-blog\/uploads\/2025\/03\/Screenshot-2025-03-28-at-9.20.22\u202fAM-768x114.png 768w, \/blog\/wp-ttn-blog\/uploads\/2025\/03\/Screenshot-2025-03-28-at-9.20.22\u202fAM-624x93.png 624w, \/blog\/wp-ttn-blog\/uploads\/2025\/03\/Screenshot-2025-03-28-at-9.20.22\u202fAM.png 1334w\" sizes=\"(max-width: 625px) 100vw, 625px\" \/><p id=\"caption-attachment-71247\" class=\"wp-caption-text\">Media 3 imports<\/p><\/div><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Yep, SimpleExoPlayer is now just ExoPlayer. Simple, right? \ud83d\ude06<\/p>\n<h3>2. Player Initialization (Same, But Shinier\u2728)<\/h3>\n<p>ExoPlayer 2:<\/p>\n<div id=\"attachment_71248\" style=\"width: 635px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-71248\" decoding=\"async\" loading=\"lazy\" class=\"size-large wp-image-71248\" src=\"https:\/\/www.tothenew.com\/blog\/wp-ttn-blog\/uploads\/2025\/03\/Screenshot-2025-03-28-at-9.22.40\u202fAM-1024x71.png\" alt=\"Player Initialization Exoplayer 2\" width=\"625\" height=\"43\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2025\/03\/Screenshot-2025-03-28-at-9.22.40\u202fAM-1024x71.png 1024w, \/blog\/wp-ttn-blog\/uploads\/2025\/03\/Screenshot-2025-03-28-at-9.22.40\u202fAM-300x21.png 300w, \/blog\/wp-ttn-blog\/uploads\/2025\/03\/Screenshot-2025-03-28-at-9.22.40\u202fAM-768x53.png 768w, \/blog\/wp-ttn-blog\/uploads\/2025\/03\/Screenshot-2025-03-28-at-9.22.40\u202fAM-624x43.png 624w, \/blog\/wp-ttn-blog\/uploads\/2025\/03\/Screenshot-2025-03-28-at-9.22.40\u202fAM.png 1218w\" sizes=\"(max-width: 625px) 100vw, 625px\" \/><p id=\"caption-attachment-71248\" class=\"wp-caption-text\"><strong>Player Initialization Exoplayer <br \/><\/strong><\/p><\/div>\n<p>Media3:<\/p>\n<p>&nbsp;<\/p>\n<div id=\"attachment_71249\" style=\"width: 635px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-71249\" decoding=\"async\" loading=\"lazy\" class=\"size-large wp-image-71249\" src=\"https:\/\/www.tothenew.com\/blog\/wp-ttn-blog\/uploads\/2025\/03\/Screenshot-2025-03-28-at-9.24.04\u202fAM-1024x78.png\" alt=\"Player Initialization Media 3\" width=\"625\" height=\"48\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2025\/03\/Screenshot-2025-03-28-at-9.24.04\u202fAM-1024x78.png 1024w, \/blog\/wp-ttn-blog\/uploads\/2025\/03\/Screenshot-2025-03-28-at-9.24.04\u202fAM-300x23.png 300w, \/blog\/wp-ttn-blog\/uploads\/2025\/03\/Screenshot-2025-03-28-at-9.24.04\u202fAM-768x59.png 768w, \/blog\/wp-ttn-blog\/uploads\/2025\/03\/Screenshot-2025-03-28-at-9.24.04\u202fAM-624x48.png 624w, \/blog\/wp-ttn-blog\/uploads\/2025\/03\/Screenshot-2025-03-28-at-9.24.04\u202fAM.png 1048w\" sizes=\"(max-width: 625px) 100vw, 625px\" \/><p id=\"caption-attachment-71249\" class=\"wp-caption-text\">Player Initialization Media 3<\/p><\/div>\n<p>If you were expecting something earth-shattering, sorry. But hey, at least it\u2019s cleaner!<\/p>\n<h3><\/h3>\n<h3>3. Setting Up Media Items (A Tiny Bit Different)<\/h3>\n<p>Before:<\/p>\n<div id=\"attachment_71250\" style=\"width: 635px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-71250\" decoding=\"async\" loading=\"lazy\" class=\"size-large wp-image-71250\" src=\"https:\/\/www.tothenew.com\/blog\/wp-ttn-blog\/uploads\/2025\/03\/Screenshot-2025-03-28-at-9.25.02\u202fAM-1024x107.png\" alt=\"Setting up Media Item Exoplayer 2\" width=\"625\" height=\"65\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2025\/03\/Screenshot-2025-03-28-at-9.25.02\u202fAM-1024x107.png 1024w, \/blog\/wp-ttn-blog\/uploads\/2025\/03\/Screenshot-2025-03-28-at-9.25.02\u202fAM-300x31.png 300w, \/blog\/wp-ttn-blog\/uploads\/2025\/03\/Screenshot-2025-03-28-at-9.25.02\u202fAM-768x80.png 768w, \/blog\/wp-ttn-blog\/uploads\/2025\/03\/Screenshot-2025-03-28-at-9.25.02\u202fAM-624x65.png 624w, \/blog\/wp-ttn-blog\/uploads\/2025\/03\/Screenshot-2025-03-28-at-9.25.02\u202fAM.png 1126w\" sizes=\"(max-width: 625px) 100vw, 625px\" \/><p id=\"caption-attachment-71250\" class=\"wp-caption-text\">Setting up Media Item Exoplayer 2<\/p><\/div>\n<p>Now:<\/p>\n<div id=\"attachment_71251\" style=\"width: 635px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-71251\" decoding=\"async\" loading=\"lazy\" class=\"size-large wp-image-71251\" src=\"https:\/\/www.tothenew.com\/blog\/wp-ttn-blog\/uploads\/2025\/03\/Screenshot-2025-03-28-at-9.25.57\u202fAM-1024x185.png\" alt=\"Setting up Media Item Media 3\" width=\"625\" height=\"113\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2025\/03\/Screenshot-2025-03-28-at-9.25.57\u202fAM-1024x185.png 1024w, \/blog\/wp-ttn-blog\/uploads\/2025\/03\/Screenshot-2025-03-28-at-9.25.57\u202fAM-300x54.png 300w, \/blog\/wp-ttn-blog\/uploads\/2025\/03\/Screenshot-2025-03-28-at-9.25.57\u202fAM-768x139.png 768w, \/blog\/wp-ttn-blog\/uploads\/2025\/03\/Screenshot-2025-03-28-at-9.25.57\u202fAM-624x113.png 624w, \/blog\/wp-ttn-blog\/uploads\/2025\/03\/Screenshot-2025-03-28-at-9.25.57\u202fAM.png 1248w\" sizes=\"(max-width: 625px) 100vw, 625px\" \/><p id=\"caption-attachment-71251\" class=\"wp-caption-text\">Setting up Media Item Media 3<\/p><\/div>\n<p>Now you get to use a Builder, which makes it easier to expand media item configurations.<\/p>\n<h3><\/h3>\n<h3>4. MediaSession and MediaController (Because Your App Deserves System Controls)<\/h3>\n<p>Instead of MediaSessionConnector, use MediaSession:<\/p>\n<div id=\"attachment_71252\" style=\"width: 635px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-71252\" decoding=\"async\" loading=\"lazy\" class=\"size-large wp-image-71252\" src=\"https:\/\/www.tothenew.com\/blog\/wp-ttn-blog\/uploads\/2025\/03\/Screenshot-2025-03-28-at-9.27.23\u202fAM-1024x71.png\" alt=\"Use Media Session in Media 3\" width=\"625\" height=\"43\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2025\/03\/Screenshot-2025-03-28-at-9.27.23\u202fAM-1024x71.png 1024w, \/blog\/wp-ttn-blog\/uploads\/2025\/03\/Screenshot-2025-03-28-at-9.27.23\u202fAM-300x21.png 300w, \/blog\/wp-ttn-blog\/uploads\/2025\/03\/Screenshot-2025-03-28-at-9.27.23\u202fAM-768x54.png 768w, \/blog\/wp-ttn-blog\/uploads\/2025\/03\/Screenshot-2025-03-28-at-9.27.23\u202fAM-624x44.png 624w, \/blog\/wp-ttn-blog\/uploads\/2025\/03\/Screenshot-2025-03-28-at-9.27.23\u202fAM.png 1290w\" sizes=\"(max-width: 625px) 100vw, 625px\" \/><p id=\"caption-attachment-71252\" class=\"wp-caption-text\">Use Media Session in Media 3<\/p><\/div>\n<p>Want playback controls? \ud83d\udd79\ufe0f<\/p>\n<div id=\"attachment_71253\" style=\"width: 635px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-71253\" decoding=\"async\" loading=\"lazy\" class=\"size-large wp-image-71253\" src=\"https:\/\/www.tothenew.com\/blog\/wp-ttn-blog\/uploads\/2025\/03\/Screenshot-2025-03-28-at-9.28.38\u202fAM-1024x54.png\" alt=\"Use Media Controller in Media 3\" width=\"625\" height=\"33\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2025\/03\/Screenshot-2025-03-28-at-9.28.38\u202fAM-1024x54.png 1024w, \/blog\/wp-ttn-blog\/uploads\/2025\/03\/Screenshot-2025-03-28-at-9.28.38\u202fAM-300x16.png 300w, \/blog\/wp-ttn-blog\/uploads\/2025\/03\/Screenshot-2025-03-28-at-9.28.38\u202fAM-768x40.png 768w, \/blog\/wp-ttn-blog\/uploads\/2025\/03\/Screenshot-2025-03-28-at-9.28.38\u202fAM-624x33.png 624w, \/blog\/wp-ttn-blog\/uploads\/2025\/03\/Screenshot-2025-03-28-at-9.28.38\u202fAM.png 1446w\" sizes=\"(max-width: 625px) 100vw, 625px\" \/><p id=\"caption-attachment-71253\" class=\"wp-caption-text\">Use Media Controller in Media 3<\/p><\/div>\n<p>More modern, more Jetpack-y. \ud83c\udfce\ufe0f<\/p>\n<h3><\/h3>\n<p>&nbsp;<\/p>\n<h3>5. UI Components (Yes, You Need to Update Your XML)<\/h3>\n<p>If your XML looks like this:<\/p>\n<div id=\"attachment_71254\" style=\"width: 635px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-71254\" decoding=\"async\" loading=\"lazy\" class=\"size-large wp-image-71254\" src=\"https:\/\/www.tothenew.com\/blog\/wp-ttn-blog\/uploads\/2025\/03\/Screenshot-2025-03-28-at-9.29.34\u202fAM-1024x165.png\" alt=\"Exoplayer 2 Player VIew\" width=\"625\" height=\"101\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2025\/03\/Screenshot-2025-03-28-at-9.29.34\u202fAM-1024x165.png 1024w, \/blog\/wp-ttn-blog\/uploads\/2025\/03\/Screenshot-2025-03-28-at-9.29.34\u202fAM-300x48.png 300w, \/blog\/wp-ttn-blog\/uploads\/2025\/03\/Screenshot-2025-03-28-at-9.29.34\u202fAM-768x124.png 768w, \/blog\/wp-ttn-blog\/uploads\/2025\/03\/Screenshot-2025-03-28-at-9.29.34\u202fAM-624x100.png 624w, \/blog\/wp-ttn-blog\/uploads\/2025\/03\/Screenshot-2025-03-28-at-9.29.34\u202fAM.png 1354w\" sizes=\"(max-width: 625px) 100vw, 625px\" \/><p id=\"caption-attachment-71254\" class=\"wp-caption-text\">Exoplayer 2 Player VIew<\/p><\/div>\n<p>&nbsp;<\/p>\n<p>Change it to this:<\/p>\n<div id=\"attachment_71255\" style=\"width: 635px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-71255\" decoding=\"async\" loading=\"lazy\" class=\"size-large wp-image-71255\" src=\"https:\/\/www.tothenew.com\/blog\/wp-ttn-blog\/uploads\/2025\/03\/Screenshot-2025-03-28-at-9.30.23\u202fAM-1024x181.png\" alt=\"Media 3 Player VIew\" width=\"625\" height=\"110\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2025\/03\/Screenshot-2025-03-28-at-9.30.23\u202fAM-1024x181.png 1024w, \/blog\/wp-ttn-blog\/uploads\/2025\/03\/Screenshot-2025-03-28-at-9.30.23\u202fAM-300x53.png 300w, \/blog\/wp-ttn-blog\/uploads\/2025\/03\/Screenshot-2025-03-28-at-9.30.23\u202fAM-768x136.png 768w, \/blog\/wp-ttn-blog\/uploads\/2025\/03\/Screenshot-2025-03-28-at-9.30.23\u202fAM-624x110.png 624w, \/blog\/wp-ttn-blog\/uploads\/2025\/03\/Screenshot-2025-03-28-at-9.30.23\u202fAM.png 1370w\" sizes=\"(max-width: 625px) 100vw, 625px\" \/><p id=\"caption-attachment-71255\" class=\"wp-caption-text\">Media 3 Player VIew<\/p><\/div>\n<p>&nbsp;<\/p>\n<p>Not a huge deal, but forget this and your UI won\u2019t be happy. \ud83d\ude05<\/p>\n<p>&nbsp;<\/p>\n<h3>6. Event Handling (No More EventListener )<\/h3>\n<p>If you were using EventListener, update to Listener:<\/p>\n<div id=\"attachment_71241\" style=\"width: 635px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-71241\" decoding=\"async\" loading=\"lazy\" class=\"size-large wp-image-71241\" src=\"https:\/\/www.tothenew.com\/blog\/wp-ttn-blog\/uploads\/2025\/03\/Screenshot-2025-03-27-at-11.15.52\u202fPM-1024x299.png\" alt=\"EventListener, update to Listener:\" width=\"625\" height=\"182\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2025\/03\/Screenshot-2025-03-27-at-11.15.52\u202fPM-1024x299.png 1024w, \/blog\/wp-ttn-blog\/uploads\/2025\/03\/Screenshot-2025-03-27-at-11.15.52\u202fPM-300x88.png 300w, \/blog\/wp-ttn-blog\/uploads\/2025\/03\/Screenshot-2025-03-27-at-11.15.52\u202fPM-768x224.png 768w, \/blog\/wp-ttn-blog\/uploads\/2025\/03\/Screenshot-2025-03-27-at-11.15.52\u202fPM-624x182.png 624w, \/blog\/wp-ttn-blog\/uploads\/2025\/03\/Screenshot-2025-03-27-at-11.15.52\u202fPM.png 1424w\" sizes=\"(max-width: 625px) 100vw, 625px\" \/><p id=\"caption-attachment-71241\" class=\"wp-caption-text\">EventListener, update to Listener:<\/p><\/div>\n<p>It\u2019s cleaner, and it works just the same. \ud83e\uddfc<\/p>\n<p>&nbsp;<\/p>\n<h3>7. Subtitles (Now More Elegant )<\/h3>\n<p>Subtitle setup in ExoPlayer 2:<\/p>\n<div id=\"attachment_71242\" style=\"width: 635px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-71242\" decoding=\"async\" loading=\"lazy\" class=\"size-large wp-image-71242\" src=\"https:\/\/www.tothenew.com\/blog\/wp-ttn-blog\/uploads\/2025\/03\/Screenshot-2025-03-27-at-11.19.39\u202fPM-1024x372.png\" alt=\"Subtitle setup in ExoPlayer 2:\" width=\"625\" height=\"227\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2025\/03\/Screenshot-2025-03-27-at-11.19.39\u202fPM-1024x372.png 1024w, \/blog\/wp-ttn-blog\/uploads\/2025\/03\/Screenshot-2025-03-27-at-11.19.39\u202fPM-300x109.png 300w, \/blog\/wp-ttn-blog\/uploads\/2025\/03\/Screenshot-2025-03-27-at-11.19.39\u202fPM-768x279.png 768w, \/blog\/wp-ttn-blog\/uploads\/2025\/03\/Screenshot-2025-03-27-at-11.19.39\u202fPM-624x227.png 624w, \/blog\/wp-ttn-blog\/uploads\/2025\/03\/Screenshot-2025-03-27-at-11.19.39\u202fPM.png 1432w\" sizes=\"(max-width: 625px) 100vw, 625px\" \/><p id=\"caption-attachment-71242\" class=\"wp-caption-text\">Subtitle setup in ExoPlayer 2:<\/p><\/div>\n<p>In Media3, just update the MIME type to MimeTypes.TEXT_VTT for better compatibility. \ud83c\udfa5<\/p>\n<p>&nbsp;<\/p>\n<h3>8. @UnstableApi (Handle With Care! )<\/h3>\n<p>Some APIs are now marked @UnstableApi, meaning Google might break them in a future update.<\/p>\n<div id=\"attachment_71243\" style=\"width: 635px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-71243\" decoding=\"async\" loading=\"lazy\" class=\"size-large wp-image-71243\" src=\"https:\/\/www.tothenew.com\/blog\/wp-ttn-blog\/uploads\/2025\/03\/Screenshot-2025-03-27-at-11.24.36\u202fPM-1024x181.png\" alt=\"@UnstableApi usage\" width=\"625\" height=\"110\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2025\/03\/Screenshot-2025-03-27-at-11.24.36\u202fPM-1024x181.png 1024w, \/blog\/wp-ttn-blog\/uploads\/2025\/03\/Screenshot-2025-03-27-at-11.24.36\u202fPM-300x53.png 300w, \/blog\/wp-ttn-blog\/uploads\/2025\/03\/Screenshot-2025-03-27-at-11.24.36\u202fPM-768x136.png 768w, \/blog\/wp-ttn-blog\/uploads\/2025\/03\/Screenshot-2025-03-27-at-11.24.36\u202fPM-624x111.png 624w, \/blog\/wp-ttn-blog\/uploads\/2025\/03\/Screenshot-2025-03-27-at-11.24.36\u202fPM.png 1332w\" sizes=\"(max-width: 625px) 100vw, 625px\" \/><p id=\"caption-attachment-71243\" class=\"wp-caption-text\">@UnstableApi usage<\/p><\/div>\n<p>9. Dependency Updates (Don\u2019t Forget These! \ud83d\udee0\ufe0f)<\/p>\n<p>Make sure your build.gradle includes:<\/p>\n<div id=\"attachment_71256\" style=\"width: 635px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-71256\" decoding=\"async\" loading=\"lazy\" class=\"size-large wp-image-71256\" src=\"https:\/\/www.tothenew.com\/blog\/wp-ttn-blog\/uploads\/2025\/03\/Screenshot-2025-03-28-at-9.40.46\u202fAM-1024x205.png\" alt=\"Media 3 Dependencies\" width=\"625\" height=\"125\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2025\/03\/Screenshot-2025-03-28-at-9.40.46\u202fAM-1024x205.png 1024w, \/blog\/wp-ttn-blog\/uploads\/2025\/03\/Screenshot-2025-03-28-at-9.40.46\u202fAM-300x60.png 300w, \/blog\/wp-ttn-blog\/uploads\/2025\/03\/Screenshot-2025-03-28-at-9.40.46\u202fAM-768x153.png 768w, \/blog\/wp-ttn-blog\/uploads\/2025\/03\/Screenshot-2025-03-28-at-9.40.46\u202fAM-624x125.png 624w, \/blog\/wp-ttn-blog\/uploads\/2025\/03\/Screenshot-2025-03-28-at-9.40.46\u202fAM.png 1412w\" sizes=\"(max-width: 625px) 100vw, 625px\" \/><p id=\"caption-attachment-71256\" class=\"wp-caption-text\">Media 3 Dependencies<\/p><\/div>\n<p>Without this, your app won\u2019t build, and you\u2019ll spend hours wondering why. \u23f3\ud83d\udc80<\/p>\n<hr \/>\n<p>&nbsp;<\/p>\n<h1>Final Thoughts (Aka TL;DR )<\/h1>\n<ul>\n<li>Update your package imports (com.google.android.exoplayer2 \u2192 androidx.media3)<\/li>\n<li>SimpleExoPlayer is now just ExoPlayer (because simpler is better)<\/li>\n<li>Media3 uses Builders for MediaItem<\/li>\n<li>MediaSessionConnector is gone; use MediaSession<\/li>\n<li>PlayerView XML needs updating<\/li>\n<li>No more exo_fullscreen, so DIY your fullscreen handling<\/li>\n<li>Watch out for @UnstableApi warnings<\/li>\n<li>Update your dependencies, or nothing will work. Migrating to Media3 is mostly straightforward\u2014just a few package changes, some updated APIs,<br \/>\nand a couple of missing features you\u2019ll need to reimplement. But overall, it\u2019s a cleaner, more<br \/>\nfuture-proof way to handle media playback in Android.<\/li>\n<\/ul>\n<h2>References \ud83d\udcda<\/h2>\n<ul>\n<li><a href=\"https:\/\/developer.android.com\/media\/media3\/exoplayer\/mappings\">Media3 API Mappings<\/a><\/li>\n<li><a href=\"https:\/\/developer.android.com\/media\/media3\/exoplayer\/migration-guide#exoplayer\">ExoPlayer to Media3 Migration Guide <\/a>\n<p>Happy coding, and may your app never buffer!<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Why Migrate? (Besides Google Telling You To\ud83d\ude1c) Google has spoken\u2014ExoPlayer 2 is old news, and Media3 is the new standard for Android media playback. It\u2019s 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\u2019s latest [&hellip;]<\/p>\n","protected":false},"author":1674,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":268},"categories":[518],"tags":[4845,7237,4851],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/71244"}],"collection":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/users\/1674"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/comments?post=71244"}],"version-history":[{"count":5,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/71244\/revisions"}],"predecessor-version":[{"id":71336,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/71244\/revisions\/71336"}],"wp:attachment":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/media?parent=71244"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/categories?post=71244"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/tags?post=71244"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}