Checklist
Current bug behaviour
I created an app that uses the AudioPlayers class to play a beep every 8 seconds. However, when running on an actual physical device, the sound does not come through the headphones, even if they are connected and the main audio output. I tried both Bluetooth and physical headphones on Android, and Bluetooth headphones on iOS - couldn't get the sound to come through them.
Expected behaviour
The sound would be played through the headphones, which are the current audio output device.
Steps to reproduce
- Create an app that plays a sound.
- Run the app on an physical device (either Android or iOS). Make sure headphones are connected and are the current audio output device.
- Play the sound in the app. You should hear nothing through the headphones (or maybe one initial sound, and then none after)
Code sample
Code sample
bool isPlaying = false;
final player = AudioPlayer();
AssetSource sound = AssetSource("sounds/beep.wav");
void _setIsPlaying() {
setState(() {
isPlaying = !isPlaying;
});
}
@override
void initState() {
Timer timer = Timer.periodic(Duration(seconds: 8), (timer) async {
if (isPlaying) {
await player.play(sound);
print("${DateTime.now()}: Played sound!");
}
});
super.initState();
}
Affected platforms
Android, iOS
Platform details
- iPhone XR, iOS 16.0 (20A362)
- Huawei Y9 Prime 2019 STK-L22, Android 12.0.0.225(C636E2R2P1)
AudioPlayers Version
4.0.1
Build mode
No response
Audio Files/URLs/Sources
No response
Screenshots
No response
Logs
Not applicable as the program runs fine on emulators and also on physical devices, just not playing through headphones
Related issues / more information
No response
Working on PR
Would be happy to help but am not experienced enough with Dart/Flutter to be able to do this.
Checklist
Current bug behaviour
I created an app that uses the AudioPlayers class to play a beep every 8 seconds. However, when running on an actual physical device, the sound does not come through the headphones, even if they are connected and the main audio output. I tried both Bluetooth and physical headphones on Android, and Bluetooth headphones on iOS - couldn't get the sound to come through them.
Expected behaviour
The sound would be played through the headphones, which are the current audio output device.
Steps to reproduce
Code sample
Code sample
Affected platforms
Android, iOS
Platform details
AudioPlayers Version
4.0.1
Build mode
No response
Audio Files/URLs/Sources
No response
Screenshots
No response
Logs
Not applicable as the program runs fine on emulators and also on physical devices, just not playing through headphones
Related issues / more information
No response
Working on PR
Would be happy to help but am not experienced enough with Dart/Flutter to be able to do this.