mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00

When transitioning to the next media position parameter checkpoint we estimate the position because the audio processor chain no longer provides access to the actual playout duration. The estimate using the declared speed and the last checkpoint may have drifted over time, so we currently estimate relative to the next checkpoint, which is closer and presumably provides a better estimate. However, this assumes that these checkpoint are perfectly aligned without any position jumps. The current approach has two issues: - The next checkpoint may include a position jump by design, e.g. if it was set for a new item in the playlist and the duration of the current item wasn't perfectly accurate. - The sudden switch between two estimation methods may cause a jump in the output position, which is visible when we add new media position checkpoints to the queue, not when we actually reach the playback position of the checkpoint. We can fix both issues by taking a slightly different approach: - Continuously monitor the estimate using the current checkpoint. If it starts drifting, we can adjust it directly. This way the estimate is always aligned with the actual position. - The change above means we can safely switch to using the estimate based on the previous checkpoint. This way we don't have to make assumptions about the next checkpoint and any position jumps will only happen when we actually reach this checkpoint (which is more what a user expects to see, e.g. at a playlist item transition). Issue: androidx/media#1698 PiperOrigin-RevId: 690979859 (cherry picked from commit 7c0cffdca8e51223df96bda77b7b516eedb38a34)
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.