audioplayers icon indicating copy to clipboard operation
audioplayers copied to clipboard

All I/O should be stopped or paused prior to deactivating the audio session.

Open tamoyal opened this issue 3 years ago • 1 comments

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

tamoyal avatar Jul 23 '21 04:07 tamoyal

any solutions?

Ucoon avatar Dec 30 '21 09:12 Ucoon