negative interaction with flutter_soloud
When calling .setActive(false) I get an error PlatformException(560030580, Session deactivation failed, null, null) after flutter_soloud has loaded an asset
final _session = await AudioSession.instance;
await _session.configure(const AudioSessionConfiguration.music());
final _soloud = SoLoud.instance;
await _soloud.init();
await _session.setActive(true); // completes as expected
final _ = await _soloud.loadAsset("tone.wav"); // commenting this out resolves the issue
await _session.setActive(false); // PlatformException(560030580, Session deactivation failed, null, null)
dependencies:
audio_session: ^0.1.19
flutter_soloud: ^2.0.2
Flutter (Channel stable, 3.22.2, on macOS 14.4.1 23E224 darwin-arm64, locale en-US)
---
[✓] Xcode - develop for iOS and macOS (Xcode 15.3)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 15E204a
• CocoaPods version 1.15.2
---
[✓] Connected device (4 available)
• Luke's iPhone (mobile) • 0bcxxxxxxxx • ios
• iOS 16.7.8 20H343
Hi @lukepighetti
This package merely wraps the raw API calls, in this case to AVAudioSession.setActive, and so you would need to consult Apple's documentation to understand the API response. According to the documentation, the code 560030580 corresponds to the message "AVAudioSessionErrorCodeIsBusy".
For more information, see:
https://developer.apple.com/documentation/avfaudio/avaudiosession/1616597-setactive
The session fails to activate if another audio session has higher priority than yours (such as a phone call) and neither audio session allows mixing. Deactivating an audio session with running audio objects stops the objects, makes the session inactive, and returns an AVAudioSessionErrorCodeIsBusy error.