✒ libwinmedia is sequel to this project.
Feel free to open issue anytime.
Mention in your pubspec.yaml:
dependencies:
...
flutter_audio_desktop: ^0.1.0
// Create new instance.
var audioPlayer = new AudioPlayer(id: 0)
..stream.listen(
(Audio audio) {
// Listen to playback events.
},
);
// Load audio source
audioPlayer.load(
new AudioSource.fromFile(
new File('/home/alexmercerind/music.mp3'),
),
);
// Start playback.
audioPlayer.play();
// Get audio duration.
audioPlayer.audio.duration;
// Change playback volume.
audioPlayer.setVolume(0.5);
// Change playback position.
audioPlayer.setPosition(Duration(seconds: 10));
// Get playback position.
audioPlayer.audio.position;
Timer(Duration(seconds: 10), () {
// Pause playback.
audioPlayer.pause();
}
// Few other things.
audioPlayer.audio.file;
audioPlayer.audio.isPlaying;
audioPlayer.audio.isCompleted;
audioPlayer.audio.isStopped;
Other classes & methods are documented in their docstrings very well.
See this example for a better overview.
If you want to be kind to me, then consider buying me a coffee.
Thankyou!
Platform | Status |
---|---|
Linux | Working |
Microsoft Windows | Working |
MacOS | Learn More |
I don't want to put any restrictions on how you distribute your Flutter Desktop apps, so this library comes under very permissive software, MIT license.
Since, other libraries like libvlcpp or libvlc come under GPL & LGPL licenses respectively, so there will be many restrictions if I plan to use them.
Thus, this project uses miniaudio and miniaudio_engine from David Reid under MIT license.
- David Reid for his amazing single header libraries miniaudio and miniaudio_engine.
- Thanks to MichealReed for his support to the project.