I try to play a local mp3 audio file on onPressed()
The function looks like this:
playLocal() async {
await audioPlayer.play('assets/audio/test.mp3', isLocal: true);
}
The file is located here:
pubspec.yaml:
flutter:
uses-material-design: true
assets:
- assets/audio/test.mp3
The audioplayers error:
[ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: PlatformException(Unexpected error!, Unable to access resource, java.lang.RuntimeException: Unable to access resource
This is the class i' m using.
This is pubspec.yaml
Just call it like this: