Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

22 kHz mono mp3s have wrong duration and seek behavior #1258

Open
amenders opened this issue Jun 4, 2024 · 7 comments
Open

22 kHz mono mp3s have wrong duration and seek behavior #1258

amenders opened this issue Jun 4, 2024 · 7 comments
Assignees
Labels
1 backlog bug Something isn't working

Comments

@amenders
Copy link

amenders commented Jun 4, 2024

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:

  1. Create the audio source with the supplied URI
  2. Pass the source to the player and begin playback
  3. Accessing a non-null duration will show a value over 18 minutes.

To observe the incorrect position on seek:

  1. Initialize the source and player as above, and then after playing, immediately seek to a position outside of the bufferedPosition (such as 120s).
  2. 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

@amenders amenders added 1 backlog bug Something isn't working labels Jun 4, 2024
@sethmfuller

This comment was marked as duplicate.

@MohammadAssaf10

This comment was marked as duplicate.

@sethmfuller

This comment was marked as duplicate.

@ryanheise

This comment was marked as duplicate.

@sethmfuller
Copy link

sethmfuller commented Jun 11, 2024

@sethmfuller Do you have your own MP3 example?

Yes! Here is another example, @ryanheise: https://appdata.jesuslifetogether.com/appdatafiles/mp3s/audio/1166_overcoming_the_gravitational_pull/ogp04t_jesus_is_not_your_copilot.mp3

@amenders, and I are working on the same app together. So, that's why the audio urls are from the same api. Both the track @amenders put in his original post and this one are having the same issue with incorrect durations on both of our machines.

@ryanheise

This comment was marked as off-topic.

@sethmfuller

This comment was marked as resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1 backlog bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants