flutter_audio_desktop
flutter_audio_desktop copied to clipboard
Replay or not replay, that is the question.
For some files, the player replays the audio indefinitely, for some others, it plays just once. I could not figure out what is the pattern here.
I am using the example project and running it on Windows.
Flutter version: 2.0.0 Dart version: 2.12.0 Compiler: Visual Studio Community 2019 16.9.1
You can access the audio samples below.
Hi there @elnurvl ! 👋
I'm currently working (even right now) on a better implementation of this plugin (from scratch) & it will bring a lot more features & better handling of events/playback on both C++ & Dart side. 😃 Few of the things coming real soon are, network playback, playlists, looping behaviour, way better codec/format support etc. (I'll let you know once I'm done). Learn more here.
The periodic stream based "handling of events" with just a single Stream.periodic in this badly written plugin, is a clear example of how one should not code. 😓
I appreciate your report. Now the reply, the intended behaviour of this plugin, is to NOT replay, but as you told its random, that's just because 100ms of delay isn't enough.
In future version, I won't waste CPU cycles by calling methods from Dart like this, but handle events from C++ code.
(Main reason is that there aren't any official guides or stackoverflow examples currently to see example Windows plugins, this is one of the very first plugins ever made for Windows or Linux. So, I'm figuring out the best way possible & I'm there now.)
Thankyou. Looking forward to bringing a better version of this plugin soon.
Thanks @alexmercerind jumping over here from #30.
And no worries at all, completely understand you wanting to focus on the new libvlc based version and I completely agree using FFI is the better approach for an audio package, using platform channels will just add latency which is the last thing you want in a audio application and you still have the restriction of using platform channels only from the main isolate.
For those in the future that may be interested in using a miniaudio library based approach, I've started a package call dainty_audio to provide a Dart FFI binding to miniaudio. I'm hoping to have a basic working version published shortly.
Hello @maks! I don't know how its going for you, but it is not going to be easy to provide FFI bindings as of now. I've done a lot of research now to switch to FFI in future.
You can address miniaudio from Dart but taking events/callbacks from other thread of miniaudio is very hard as of now. You should see this for an alternative approach to receive call-backs from another thread to get playback events, this is what I'll use in future.
Thanks
One other problem with FFI in general is that, it is not "streamlined" to use. One cannot run CMake for plain Dart apps.
(This comment is kinda misleading... sorry)
Hello @elnurvl !
Thanks for supporting this project. Now libVLC based alternative to this project is live: dart_vlc
Since, this project didn't make use of callbacks, but a timeout based Stream, thus this problem was bound to happen. The new plugin will fix this issue. Please consider switching.
It has (in addition to this project):
- Playlists.
- Network streaming.
- Better controls.
- Separated event streams.
- More performance & stability.
- And most importantly, better codec/format support.
Other features are in the list. Please use that plugin now instead of this one.
Hope you liked my work. I'm in collaboration with just_audio & assets_audio_player to make Flutter on Windows & Linux a more better place.