just_audio
just_audio copied to clipboard
22 kHz mono mp3s have wrong duration and seek behavior
Which API doesn't behave as documented, and how does it misbehave?
AudioPlayer.duration
, AudioPlayer.durationStream
: Do not reflect the actual duration of the mp3. In the example 22kHz mono mp3 below, the actual duration of the file is 4:09 (based on play time as well as pulling duration from ffmpeg metadata), but the reported duration
is over 18minutes
AudioPlayer.seek
, AudioPlayer.positionStream
: When seeking to a position greater than the current bufferedPosition
in a 22kHz mono mp3 (see url below), the position is reported correctly as the duration that was passed to the seek
method, but the audio playing is not from that part of the mp3. In the example of the url below, if I seek to Duration(seconds: 120)
when that position is greater than the bufferedPosition
, the audio plays from roughly the 30s position, even though the positionStream
reports an advancing play from 120s on.
Minimal reproduction project
The example. Use the following url as a AudioSource.uri
or ProgressiveAudioSource
:
"https://appdata.jesuslifetogether.com/appdatafiles/mp3s/audio/1164_lilies_sparrows_dont_have_energy_leaks/las05t_the_conservation_of_energy.mp3"
To Reproduce (i.e. user steps, not code)
Steps to reproduce the behavior:
To observe the incorrect duration
value:
- Create the audio source with the supplied URI
- Pass the source to the player and begin playback
- Accessing a non-null duration will show a value over 18 minutes.
To observe the incorrect position on seek
:
- Initialize the source and player as above, and then after playing, immediately seek to a position outside of the
bufferedPosition
(such as 120s). - The audio playback will be from roughly the 30s mark in the file, even though the
positionStream
will continue to be updated with values starting at 120s and incrementing.
Error messages
no error messages
Expected behavior
The duration
should match the actual play back time of the file, or the time contained in the metadata extracted by ffmpeg, which in this example are the same.
When seeking to a position greater than the current bufferedPosition
, the player should start playing the audio correctly from the position requested.
Screenshots N/A
Desktop (please complete the following information):
- OS: N/A
- Browser N/A
Smartphone (please complete the following information):
- Device: Samsung Galaxy A15 5G
- OS: Android 14
Flutter SDK version
[✓] Flutter (Channel stable, 3.19.3, on macOS 14.2.1 23C71 darwin-arm64, locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 15.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2023.1)
[✓] VS Code (version 1.89.1)
[✓] Connected device (5 available)
[✓] Network resources
Additional context Additional minimal repro link: https://github.com/amenders/just_audio_example