Skip to content

fix(android): support Media3 1.9 LoadControl API#5016

Open
onlystard wants to merge 1 commit into
TheWidlarzGroup:support/6.x.xfrom
onlystard:fix/media3-1-9-load-control
Open

fix(android): support Media3 1.9 LoadControl API#5016
onlystard wants to merge 1 commit into
TheWidlarzGroup:support/6.x.xfrom
onlystard:fix/media3-1-9-load-control

Conversation

@onlystard

@onlystard onlystard commented Jun 25, 2026

Copy link
Copy Markdown

Summary

Fix an Android runtime crash on the v6 line when an app resolves androidx.media3 to 1.9.0.

RNVLoadControl was compiled against Media3 1.8.0, but apps with other Android media/camera dependencies can resolve Media3 to 1.9.0 at runtime. Media3 1.9.0 changed the DefaultLoadControl constructor signature and getAllocator() API, which can cause NoSuchMethodError.

Motivation

Fixes #4895 (link)
Fixes #4900 (link)

This change is needed to keep react-native-video v6 compatible with Android apps whose dependency graph resolves Media3 to 1.9.0.

Observed crash:

java.lang.NoSuchMethodError: No direct method (...) in class androidx.media3.exoplayer.DefaultLoadControl

Changes

  • Bump RNVideo_media3Version from 1.8.0 to 1.9.0.
  • Update RNVLoadControl to use the Media3 1.9.0 DefaultLoadControl constructor.
  • Keep the existing buffer-time-priority behavior.
  • Store the provided DefaultAllocator and use it for memory-based buffering checks.
  • Enable core library desugaring in the bare Android example for the ads build, required by Media3 IMA 1.9.0.

Platforms affected

  • Android
  • iOS
  • visionOS
  • tvOS / Android TV
  • Windows
  • Web

Type of change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that changes existing behavior)
  • Documentation only

Test plan

Verified locally on the support/6.x.x branch:

bun install
bun lint
git diff --check

bun install also ran the existing build step successfully:

yarn build
yarn tsc

Expected behavior: Android builds against Media3 1.9.0, and RNVLoadControl no longer references the removed Media3 1.8.0 constructor or no-arg getAllocator() API.

Checklist

  • I read the contributing guidelines.
  • I updated the documentation / README where relevant.
  • If this changes how the library is used (API, props, events, behavior), I updated the AI agent skill (skills/react-native-video/) to match.
  • This PR is focused on a single concern.
  • I tested my changes on at least one platform.

@onlystard onlystard force-pushed the fix/media3-1-9-load-control branch from 4d44dd6 to 72f0e54 Compare June 25, 2026 04:17
@anasvemmully

Copy link
Copy Markdown

when will this be merged ?

@onlystard

Copy link
Copy Markdown
Author

when will this be merged ?

Not sure about this, let use patch for fix the crash issue first

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the Android implementation to be compatible with androidx.media3:1.9.0, addressing runtime NoSuchMethodError crashes caused by Media3 API changes when an app’s dependency graph resolves a newer Media3 version than react-native-video was compiled against.

Changes:

  • Bump the library’s Media3 version to 1.9.0.
  • Update ReactExoplayerView.RNVLoadControl to use the Media3 1.9.0 DefaultLoadControl constructor and avoid the removed getAllocator() API.
  • Enable core library desugaring in the bare Android example (for builds involving Media3 IMA 1.9.x).

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
examples/bare/android/build.gradle Adds core library desugaring configuration for the example Android app module.
android/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java Updates RNVLoadControl for the Media3 1.9 DefaultLoadControl API and allocator handling.
android/gradle.properties Bumps the pinned Media3 version from 1.8.0 to 1.9.0.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +568 to 572
config.getMinBufferMs() != BufferConfig.Companion.getBufferConfigPropUnsetInt()
? config.getMinBufferMs()
: DefaultLoadControl.DEFAULT_MIN_BUFFER_FOR_LOCAL_PLAYBACK_MS,
config.getMaxBufferMs() != BufferConfig.Companion.getBufferConfigPropUnsetInt()
? config.getMaxBufferMs()
Comment on lines +50 to +64
subprojects { subproject ->
if (subproject.name == "app") {
subproject.plugins.withId("com.android.application") {
subproject.android {
compileOptions {
coreLibraryDesugaringEnabled true
}
}

subproject.dependencies {
coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.1.5")
}
}
}
} No newline at end of file
Comment on lines +50 to +64
subprojects { subproject ->
if (subproject.name == "app") {
subproject.plugins.withId("com.android.application") {
subproject.android {
compileOptions {
coreLibraryDesugaringEnabled true
}
}

subproject.dependencies {
coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.1.5")
}
}
}
} No newline at end of file

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hey! thanks for the PR. Can you clarify why desugaring is added here?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is required for the Android example app with Ads. After updating Media3 IMA to 1.9.0, the ads example needs core library desugaring enabled in the app module, otherwise the Android example ads build may fail on older Android API compatibility checks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: To Triage

Development

Successfully merging this pull request may close these issues.

5 participants