A simple cross-platform solution for playing audio in Flutter.
LGPL-3.0 License
A cross-platform solution for playing audio in Flutter.
This project's goal is to be as simple as possible, meaning it offers the core functionality only (ex. play/pause). It also aims to be stable and relatively bug free.
I created this plugin for my music app so that I don't have to use different packages for different platforms (audio_service, dart_vlc). This made it hard to deal with bugs from different packages.
The documentation is hosted by pub.dev
. You can find it here.
pubspec.yaml
SimpleAudio.init()
in main()
(see below).SimpleAudio
object in your player controller (see below).An example player project is located here.
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await SimpleAudio.init();
runApp(const MyApp());
}
final SimpleAudio player = SimpleAudio(shouldNormalizeVolume: false);
player.playbackState.listen((state) => print(state));
player.progressState.listen((state) => print(state));
// Autoplays by default
player.open(path);
Some platform specific things have to be set up in order for this plugin to function properly.
No setup is needed.
You will have to add a dependency to your Xcode project.
Runner.xcworkspace
in the ios
folder.Runner
project.Runner
target, go to the General
tab and scroll down until you see Frameworks, Libraries, Embedded Content
+
icon and add the AudioToolbox.framework
framework. Select Do Not Embed
under the Embed
column.simple_audio
's first releases.