Is there a way to play sound with audioplayers when the device is in silent mode? My phone is always is silent mode because I don't want it to vibrate or play any sound when I get notifications. But I have some app on my phone which still get the play sounds, and that is OK and fine.
I was wondering if I can't do the same with audioplayers or any other package.
final AudioPlayer player;
void playNotificationSound() async {
await player.setPlayerMode(PlayerMode.lowLatency);
await player.play(AssetSource(audioFilePlath));
}
Here's how you can change your code to use the
audioplayerspackage for playing notification sounds:Make sure you've added the necessary permissions in your app's AndroidManifest.xml and Info.plist files to allow audio playback. Doing this should help ensure that your app can play audio files without any issues.