Skip to content

Migrate from ExoPlayer 2.x to AndroidX Media3 - #207

Open
dipenpradhan wants to merge 7 commits into
Gurupreet:masterfrom
dipenpradhan:issue-183-media3
Open

Migrate from ExoPlayer 2.x to AndroidX Media3#207
dipenpradhan wants to merge 7 commits into
Gurupreet:masterfrom
dipenpradhan:issue-183-media3

Conversation

@dipenpradhan

Copy link
Copy Markdown

Summary

Migrates from the deprecated ExoPlayer 2.x to AndroidX Media3 1.5.1, as proposed in #183.

  • com.google.android.exoplayer:exoplayer:2.19.1androidx.media3:media3-exoplayer + androidx.media3:media3-ui
  • Versions.kt: exoplayer constant replaced with media3
  • TikTokPlayer.kt (the only ExoPlayer consumer in the codebase — the YouTube demo doesn't actually use ExoPlayer) rewritten against Media3:
    • SimpleExoPlayer (removed in Media3) → ExoPlayer.Builder
    • manual ProgressiveMediaSource/DefaultDataSourceFactory wiring dropped in favor of setMediaItem — the default media source factory resolves asset:/// URIs
    • imports moved to androidx.media3.*; @OptIn(UnstableApi::class) for PlayerView/resizeMode

As a bonus, Media3 is AndroidX-native, removing the last Jetifier warning that ExoPlayer 2.x produced during builds.

Closes #183

Verification

  • ./gradlew ktfmtCheck assembleDebug testDebugUnitTest passes locally (JDK 17, SDK 35)
  • TikTok demo video playback is asset-based (t1.mp4t3.mp4); the player wiring is unchanged apart from the API rename
  • CI ./gradlew build on this PR

Merge order

PR 7 of the stacked series. Depends on #195#196#197#204#205#206 — its diff includes their commits until they merge.

🤖 Generated with Claude Code

cc @Gurupreet for review

- Bump kotlin-gradle-plugin 1.9.22 -> 2.1.20 (root + buildSrc)
- Adopt the new Compose Compiler Gradle plugin
  (org.jetbrains.kotlin.plugin.compose) in app and convention plugins
- Drop composeCompiler version constant and composeOptions blocks
- Replace removed -Xopt-in flag with -opt-in
- Bump KSP to 2.1.20-1.0.31 to match Kotlin

Fixes Gurupreet#182
ktfmt-gradle 0.12.0 fails with 'Generic error during file processing'
once Kotlin 2.x is on the buildscript classpath. 0.22.0 supports
Kotlin 2.x and also formats *.kts build scripts, hence the repo-wide
reformat (no functional changes).
- AGP 8.2.2 -> 8.7.3 (compileSdk 35 supported from AGP 8.6)
- Gradle wrapper 8.5 -> 8.9 (required by AGP 8.7.x)
- PinLockView: removeLast() -> removeAt(lastIndex); at compileSdk 35 the
  call binds to java.util.List#removeLast (API 35) instead of the Kotlin
  stdlib extension, failing lint NewApi against minSdk 25

Fixes Gurupreet#185
- Replace compose/material3 version constants with composeBom
- Strip explicit versions from BOM-managed artifacts
- Import the BOM platform on every configuration that receives
  Compose artifacts (implementation, debugImplementation,
  androidTestImplementation, :data)
- Migrate API removals that come with Compose 1.7 / Material3 1.3:
  SmallTopAppBar -> TopAppBar, rememberRipple -> material3 ripple
- Update the outdated README Compose badge to the BOM version

Fixes Gurupreet#186
All lifecycle artifacts (viewmodel-compose, viewmodel-ktx,
livedata-ktx, runtime-ktx, viewmodel-savedstate) move together
via the shared androidLifecycleGrouped version.

Fixes Gurupreet#192
- navCompose 2.7.7 -> 2.8.9; add kotlinx-serialization-json 1.8.0
- Apply the Kotlin serialization plugin in gmail and tiktok demos
- Gmail: string routes -> @serializable route objects
- TikTok: TikTokScreen becomes a serializable sealed interface;
  the profile route carries a typed userId argument read via
  toRoute(), bottom bar selection uses NavDestination.hasRoute

Fixes Gurupreet#193
- Replace com.google.android.exoplayer:exoplayer with
  androidx.media3:media3-exoplayer and media3-ui
- Rewrite TikTokPlayer against the Media3 API (SimpleExoPlayer was
  removed; default media source factory handles asset URIs)
- Removes the last Jetifier warning produced by ExoPlayer 2.x

Fixes Gurupreet#183
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.

Bug/Deprecation: Migrate from ExoPlayer 2.x to AndroidX Media3

1 participant