ryanheise / just_audio

Audio Player
1.03k stars 652 forks source link

seek the flac format audio cannot be set to the correct position, and return positionStream value is wrong #719

Closed zhushenwudi closed 2 years ago

zhushenwudi commented 2 years ago

Which API doesn't behave as documented, and how does it misbehave? just_audio api 0.9.21 when flac format music use seek method to the end, it will play uncorrect position When the progress bar shows that the audio is playing at the end, it is not finished yet and will continue for some time, positionstream is also return back error. even the playback time exceeds the total time

Minimal reproduction project Provide a link here using one of two options: https://github.com/zhushenwudi/just_audio_seek_demo

To Reproduce (i.e. user steps, not code) Steps to reproduce the behavior:

  1. press button to play music
  2. seek the seekbar to 5:10
  3. play position is error

Error messages

no error message log

Expected behavior Use other player to play and seek are normal The audio playback exceeds the total audio duration when seek to end

Screenshots no screenshots

Desktop (please complete the following information):

Smartphone (please complete the following information):

Flutter SDK version

[✓] Flutter (Channel stable, 2.10.4, on macOS 12.3 21E230 darwin-x64, locale zh-Hans-CN)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.1)
[☠] IntelliJ IDEA Ultimate Edition (the doctor check crashed)
    ✗ Due to an error, the doctor check did not complete. If the error message below is not helpful, please let us know about this issue at
      https://github.com/flutter/flutter/issues.
    ✗ FormatException: Unexpected extension byte (at offset 5)
[✓] VS Code (version 1.63.2)
[✓] Connected device (3 available)
[!] HTTP Host Availability
    ✗ HTTP host https://maven.google.com/ is not reachable. Reason: An error occurred while checking the HTTP host: Operation timed out

! Doctor found issues in 2 categories.

Additional context Add any other context about the problem here. no

ryanheise commented 2 years ago

Does your FLAC file have an accurate seek table?

zhushenwudi commented 2 years ago

Does your FLAC file have an accurate seek table?

no, it converted by wav

zhushenwudi commented 2 years ago

but other player can seek correct, i don't understand why need the seek table

ryanheise commented 2 years ago

This is the behaviour of iOS's framework player. Maybe you're making it difficult for yourself if you want to do seeking, but you also don't use a format that is designed for seeking. The purpose of a seek table is to support accurate seeking.

zhushenwudi commented 2 years ago

Yes, flac has a smaller footprint, and the PC side uses the same FLAC format. So I give priority to this format

ryanheise commented 2 years ago

Why not add a seek table to the FLAC file so that you can accurately seek?

zhushenwudi commented 2 years ago

So other music players don't use AvAudioPlayer, but use lower-level classes to achieve this effect? At present, I don't quite understand this part of the knowledge, I will search online, or you have any experience. What channels are available to get the seek table.

ryanheise commented 2 years ago

So other music players don't use AvAudioPlayer, but use lower-level classes to achieve this effect?

That may be the case.

As for the seek table, I can't advise on what tools you can use for your OS, but Google may help.

zhushenwudi commented 2 years ago

Ok, I think I get it, 3Q

github-actions[bot] commented 2 years ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs, or use StackOverflow if you need help with just_audio.