just_audio
just_audio copied to clipboard
Feature Request: Support more audio file formats
Since the migration to exoplayer I think supporting all the various audio file formats should be done. Currently in my testing I discovered that .flac files do not play. I had been only testing using .mp3 this whole time. Hope support for all audio formats can be added in future updates.
Flac work but something got this kind of errors on Android:
2
W/DefaultLoadControl(12906): Target buffer size reached with less than 500ms of buffered media data.
E/ExoPlayerImplInternal(12906): Playback error
E/ExoPlayerImplInternal(12906): com.google.android.exoplayer2.ExoPlaybackException: Unexpected runtime error
E/ExoPlayerImplInternal(12906): at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:608)
E/ExoPlayerImplInternal(12906): at android.os.Handler.dispatchMessage(Handler.java:103)
E/ExoPlayerImplInternal(12906): at android.os.Looper.loop(Looper.java:214)
E/ExoPlayerImplInternal(12906): at android.os.HandlerThread.run(HandlerThread.java:67)
E/ExoPlayerImplInternal(12906): Caused by: java.lang.IllegalStateException: Playback stuck buffering and not loading
E/ExoPlayerImplInternal(12906): at com.google.android.exoplayer2.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:1046)
E/ExoPlayerImplInternal(12906): at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:482)
E/ExoPlayerImplInternal(12906): ... 3 more
E/AudioPlayer(12906): TYPE_UNEXPECTED: Playback stuck buffering and not loading
But when I use the same with mp3 everything works fine.
I think in the time since this feature request was made, ExoPlayer (the underlying Android library from Google that provides the Android audio playing capabilities) has undergone a lot of improvements. But if FLAC has any issue still, I think it's due to the FLAC support from ExoPlayer itself. You could try submitting a bug report with ExoPlayer with that specific FLAC file. In terms of a minimal reproduction project, I think they have an official example and you can just switch in your FLAC file for one of the existing MP3 URLs in that sample code.
Alright thanks, I will investigate on the ExoPlayer itself.
I just test the Flac demo on the Exoplayer, and the buffering was OK. I think it's probably because the just_audio is on 2.15.0.
I will try to use the lastest version of ExoPlayer the 2.17.1
https://mvnrepository.com/artifact/com.google.android.exoplayer/exoplayer
Sounds like a plan. Please let me know how it goes, and if it solves the FLAC problem, I'll update the plugin's version.
I will fill a PR if it's fix. I will let you know if it's not ;) !
Seems to be more complicated than I think. Got a lot of deprecation, and 2 failures when trying to run the example/android
. I will need more time to configure the project to be able to debug it. Can you try to upgrade to 2.17.1
in your side ?
That's fine. If it involves changes to the code, leave it to me and I'll upgrade everything.
So I will let you change the version ;) !
Just to update, I have migrated to ExoPlayer 2.17.1 in the latest commit on branch fix/flutter3
. Note that this version of ExoPlayer contains enough methods that you'll probably get a trigger to use multidex.
That branch has now been merged and published to pub.dev.