
For sync-sample-only formats, we have an optimization to drop all buffers with less than the start time when writing them to the queue. For the same formats, if we set a new start time (=seek), we only seek to the buffer at or before the start time. This means the first sample in the queue is different depending on whether we seek to a start time or set a start time and then write samples. This is inconsistent and effectively means the first sample depends on a race condition between the Loader thread (writing samples) and the playback thread (attempting an initial seek in the already loaded samples). The effect of this inconsistency is that we have to decode one sample we don't need (and could have skipped) and that some tests become flaky if the test setup runs into the mentioned race condition. The fix is to change the SampleQueue seek method to also seek to a sample at or after the specified time, to align the behavior to the case where we write the same samples to an empty queue. The change also clarifies the Javadoc of MimeTypes.allSamplesAreSyncSamples to note that this should really only return true if the samples have no "duration" that matters. Otherwise, we could reasonably return true for most subtitle formats although it would break subtitle display because we'd remove samples that start before the seek time. PiperOrigin-RevId: 547189941
ExoPlayer module
This module provides ExoPlayer
, the Player
implementation for local media
playback on Android.
Getting the module
The easiest way to get the module is to add it as a gradle dependency:
implementation 'androidx.media3:media3-exoplayer:1.X.X'
where 1.X.X
is the version, which must match the version of the other media
modules being used.
Alternatively, you can clone this GitHub project and depend on the module locally. Instructions for doing this can be found in the top level README.