I use the audioplayers class and everytime I call the player.play('timer.mp3') it gives me this errer:
Reusing soundId 1 for file:///data/user/0/com.example.secret_app/cache/timer.mp3 is loading=false xyz.luan.audioplayers.WrappedSoundPool@6232270
W/SoundPool(25113): play soundID 1 not READY
my code:
import 'package:audioplayers/audioplayers.dart';
...
class _HomeState extends State<Home> {
static AudioCache player = AudioCache();
...
initState(() {
super.initState();
player.load('timer.mp3');
})
...
_playSound() {
player.play('timer.mp3', mode: PlayerMode.LOW_LATENCY, volume: 1);
}
...
}
I also imported the file correctly in the pubpec.yaml file. I have no clue why it doesn't play the sound since it already worked with the same code.
If you want to play an audio file, you need to do the following:
In your
pubspec.yml
, use:then
then go to your class and type:
And that's it; it will work perfectly.