Flutter-AssetsAudioPlayer
Flutter-AssetsAudioPlayer copied to clipboard
Audio fails to play on iOS 16
Flutter Version
My version : 3.3.1
Lib Version
My version : 3.0.5
Platform (Android / iOS / web) + version
Platform : iOS 16
Describe the bug
I use this plugin to play sound effects. The code runs in onWillChange method of a Redux Store Connector. Audio plays well on devices running iOS 15, but not on iOS 16. Here is the error log from iOS 16:
url: file:///private/var/containers/Bundle/Application/663C5395-11DC-4A4B-B9EF-6CF79DE30715/Runner.app/Frameworks/App.framework/flutter_assets/assets/sounds/Inhale.wav [as_client] AVAudioSession_iOS.mm:2370 Failed to set category, error: 'what' The operation couldn't be completed. (OSStatus error 2003329396.) flutter: [info] log: The operation couldn't be completed. (OSStatus error 2003329396.) flutter: [info] PlatformException(PLAY_ERROR, Cannot play assets/sounds/Inhale.wav, The operation couldn't be completed. (OSStatus error 2003329396.), null) flutter: [error] CAUGHT APP EXCEPTION: PlatformException(PLAY_ERROR, Cannot play assets/sounds/Inhale.wav, The operation couldn't be completed. (OSStatus error 2003329396.), null)
Small code to reproduce
late AssetsAudioPlayer player;
Audio inhaleAudio = Audio('assets/sounds/Inhale.wav');
@override
void initState() {
player = AssetsAudioPlayer.newPlayer();
super.initState();
}
@override
Widget build(BuildContext context) {
return StoreConnector<AppState, _ViewModel>(
onWillChange: (oldViewModel, viewModel) async {
await player.open(
inhaleAudio,
autoStart: true,
showNotification: false,
);
},
...,
);
}
@florent37 Any updates on this? Our users with iOS 16 still can't hear any sounds
Did you resolve this?