audioplayers icon indicating copy to clipboard operation
audioplayers copied to clipboard

iOS audio gets muted when Notification Center is opened and phone is on silent mode.

Open sezer-healthlogix opened this issue 2 years ago • 1 comments

I've noticed when I have my iPhone on silent mode and drag down the Notification Center the audio is muted but the audio player is still running.

Platforms iOS

  • OS: iOS
  • OS version: 15.5
  • Device: iPhone 7 (Physical device)
  • flutter version: 3.0.1
  • audioplayers version: 0.20.1
  • release or not release: debug

sezer-healthlogix avatar Jun 07 '22 02:06 sezer-healthlogix

Has anyone else been able to recreate this?

sezer-healthlogix avatar Aug 11 '22 03:08 sezer-healthlogix

Add this to your code

final AudioContext audioContext = AudioContext(
    iOS: AudioContextIOS(
      defaultToSpeaker: true,
      category: AVAudioSessionCategory.ambient,
      options: [],
    ),
    android: AudioContextAndroid(
      isSpeakerphoneOn: true,
      stayAwake: true,
      contentType: AndroidContentType.sonification,
      usageType: AndroidUsageType.assistanceSonification,
      audioFocus: AndroidAudioFocus.gain,
    ),
  );

Aqeelhasan22 avatar Jan 08 '23 09:01 Aqeelhasan22