I am trying to use the flutter audioplayers package to play audio files and am getting this error. While following an online flutter tutorial I had this exact code and it ran and produced sound correctly, but now it doesn't play audio. I think maybe there is a change in my IDE settings or a change on my computer, but I don't know how to find the issue.
E/MediaPlayerNative(13949): error (1, -19)
E/MediaPlayer(13949): Error (1,-19)
E/MediaPlayerNative(13949): stop called in state 0, mPlayer(0xb4e843c0)
E/MediaPlayerNative(13949): error (-38, 0)
V/MediaPlayer(13949): resetDrmState: mDrmInfo=null mDrmProvisioningThread=null mPrepareDrmInProgress=false mActiveDrmScheme=false
V/MediaPlayer(13949): cleanDrmObj: mDrmObj=null mDrmSessionId=null
V/MediaPlayer(13949): resetDrmState: mDrmInfo=null mDrmProvisioningThread=null mPrepareDrmInProgress=false mActiveDrmScheme=false
V/MediaPlayer(13949): cleanDrmObj: mDrmObj=null mDrmSessionId=null
Here is the code I'm using to test the audioplayers package.
import 'package:flutter/material.dart';
import 'package:audioplayers/audio_cache.dart';
void main() => runApp(XylophoneApp());
class XylophoneApp extends StatelessWidget {
final player = AudioCache();
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: SafeArea(
child: Center(
child: FlatButton(
color: Colors.red,
onPressed: () {
player.play('note1.wav');
},
child: Text('Click Me'),
),
),
),
),
);
}
}
i faced the same issue , and no solution works for me , until i changed the package , check this one , it's very nice and works without any problem . assets_audio
playQRScannerSound() async {
AssetsAudioPlayer.newPlayer().open(
Audio("assets/audios/scan_Beep.mp3"),
autoStart: true,
);
}
I hope it help you , best of luck .
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With