build(android): update Media3 to 1.11.1

Pins every androidx.media3 module to 1.11.1 from the root build, so
video_player_android's exoplayer, HLS, DASH, RTSP and SmoothStreaming
modules (which still ask for 1.9.2) resolve to the same version as the
playback engine.

1.11.1 keeps the float output and Sonic rules the engine relies on for
high resolution PCM and platform speed changes. The PCM AudioTrack
buffer is now a fixed 500 ms instead of four times the platform minimum,
so with the 2x cap the engine buffers 1 s at 1x; the comments now say so.
This commit is contained in:
zarzet committed 2026-11-08 03:45:07 +07:00
1 parent 7dc5e65d62
commit e0653009b2
3 files changed
+25 -11

No files matched your search

+2 -2
View File
@@ -217,8 +217,8 @@ dependencies {
implementation("androidx.documentfile:documentfile:1.1.0")
implementation("androidx.activity:activity-ktx:1.13.0")
implementation("com.google.android.gms:play-services-cast-framework:23.0.0")
// Same version video_player_android bundles, so the APK keeps one copy.
implementation("androidx.media3:media3-exoplayer:1.9.2")
// The root build pins every Media3 module, video_player_android's too.
implementation("androidx.media3:media3-exoplayer:${rootProject.extra["media3Version"]}")
// NativeDownloadFinalizer imports FFmpegKit APIs directly. The Flutter
// plugin owns the runtime AAR; compileOnly avoids packaging it twice here.
compileOnly("com.antonkarpenko:ffmpeg-kit-audio:2.2.3")
@@ -30,7 +30,7 @@ import io.flutter.plugin.common.MethodChannel
*
* High resolution: float output is on, and speed goes through the platform
* `AudioTrack.setPlaybackParams` (audio output playback parameters). In
* media3 1.9.2 `DefaultAudioSink` sends 24/32-bit PCM to a float
* media3 1.11.1 `DefaultAudioSink` sends 24/32-bit PCM to a float
* `AudioTrack` only with float output enabled; otherwise the decoder is asked
* for 16-bit PCM and the low bits are lost. With float output its audio
* processor chain (Sonic) is skipped for that PCM, so Sonic speed changes
@@ -53,14 +53,14 @@ internal fun media3AudioRenderers(context: Context) = RenderersFactory { handler
/**
* The fastest speed the `AudioTrack` buffer is sized for. With platform
* playback parameters media3 1.9.2 multiplies its PCM buffer (four times
* the platform minimum, kept within 250 to 750 ms) by 8, the fastest
* `AudioTrack` speed, so it still holds that much time at 8x. That makes
* about 3 s at 1x. Once a song's end is in the buffer the track is told to
* play out, so a song queued later than that opens a new track at the
* handoff, and a short song before a queued one waits on the buffer. The app
* changes speed by at most 1.2x (AutoMix), so sizing for 2x keeps at least
* the 1x buffer's time up to 2x at a quarter of the size. Volume
* playback parameters media3 1.11.1 multiplies its PCM buffer (a fixed
* 500 ms) by 8, the fastest `AudioTrack` speed, so it still holds that much
* time at 8x. That makes 4 s at 1x. Once a song's end is in the buffer the
* track is told to play out, so a song queued later than that opens a new
* track at the handoff, and a short song before a queued one waits on the
* buffer. The app changes speed by at most 1.2x (AutoMix), so sizing for 2x
* keeps at least the 1x buffer's time up to 2x at a quarter of the size: 1 s
* at 1x. Volume
* (`AudioTrack.setVolume`), speed and the session equalizer act after this
* buffer, so its size does not delay them.
*/
+14
View File
@@ -5,6 +5,20 @@ allprojects {
}
}
// Media3 modules must all be one version. The app's playback engine and
// video_player_android (exoplayer plus its HLS, DASH, RTSP and
// SmoothStreaming modules) each ask for their own, so pin the whole group.
extra["media3Version"] = "1.11.1"
subprojects {
configurations.configureEach {
resolutionStrategy.eachDependency {
if (requested.group == "androidx.media3") {
useVersion(rootProject.extra["media3Version"] as String)
}
}
}
}
subprojects {
afterEvaluate {
if (project.hasProperty("android")) {