audioplayers
audioplayers copied to clipboard
All I/O should be stopped or paused prior to deactivating the audio session.
I receive an error from AVAudioSession
(iOS) when using the AudioCache
class in a fairly simple scenario.
Full Description
When playing a file using the AudioCache
, I consistently see this error in my logs:
[avas] AVAudioSession_iOS.mm:1206 Deactivating an audio session that has running I/O. All I/O should be stopped or paused prior to deactivating the audio session.
[plugin] Error deactivation: The operation couldn’t be completed. (OSStatus error 560030580.)
Code to Reproduce My audio class looks like this.
import 'package:audioplayers/src/audio_cache.dart';
import 'package:audioplayers/audioplayers.dart';
class ChatSounds {
static final cache =
AudioCache(fixedPlayer: AudioPlayer(mode: PlayerMode.LOW_LATENCY));
Future<void> playCorrect() async {
await cache.play('sounds/correct.mp3', volume: 0.5);
}
}
Then I just call playCorrect
in a widget. Nothing crazy but happy to create a new Flutter project with this if it helps.
This is the file (zipped because github doesn't accept mp3s): correct.mp3.zip
Platform stuffz:
iOS 4.6
iPhone Xs
Flutter 2.2.3 (stable)
audioplayers version 0.19.1
any solutions?