flutter_audio_desktop 0.0.2 flutter_audio_desktop: ^0.0.2 copied to clipboard
A simple yet functional audio library for Flutter Desktop.
flutter_audio_desktop #
A simple yet functional audio library for Flutter Desktop. #
Right now, as it is just a start, it supports MP3 playback. I'll try to increase the domain of support formats with time & plan is to provide metadata of a track aswell.
Try Now #
git clone http://github.com/alexmercerind/flutter_audio_desktop.git --depth=1
cd flutter_audio_desktop
flutter pub get
cd example
flutter run
Feel free to open issue anytime.
Usage #
For usage in your Flutter Desktop app, checkout this simple implementation.
Easy To Use
// Start AudioPlayer. Set debug: true for extra logs.
var audioPlayer = new AudioPlayer(debug: false);
// Load audio file.
audioPlayer.load('./music.mp3');
// Start playing loaded audio file.
audioPlayer.play();
print('Duration Of Track: ${audioPlayer.getDuration()}');
// Change playback volume.
audioPlayer.setVolume(0.5);
print('Changed volume to 50%.');
// Change playback position.
audioPlayer.setPosition(Duration(seconds: 10));
print('Position of playback after skipping 60 seconds: ${audioPlayer.getPosition()}');
Timer(Duration(seconds: 10), () {
// Pause the playback.
audioPlayer.pause();
print('Playback of audio stopped after 10 seconds.');
}
Like the library? #
Feel free to use in your Flutter Desktop app. Consider ⭐ starring the repository if you want to support the development & appreciate the effort.
Progress #
The library is only supported on x64 systems right now.
Platform | Status | Remark |
---|---|---|
Linux | Working | |
Windows | Not Tested | Coming Soon |
MacOS | Not Tested |
How It Works ? #
One word, C++. I had experience with C++ & it simply uses dart::ffi for accessing Native C++ for playing audio. It uses the Changed native code to use miniaudio from David Reid.
I wrote this simple wrapper around his library to get this working.
There is not any audio playback library for Flutter Desktop at the moment, so I decided to write one myself.