From c4fa62d07dac1c3855dae4ed5108ab0f3eb43ceb Mon Sep 17 00:00:00 2001 From: Jaakko Keränen Date: Tue, 17 Aug 2021 07:06:07 +0300 Subject: iOS: Setting the audio session category --- src/ios.m | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ios.m b/src/ios.m index b82d54a7..c493e4f9 100644 --- a/src/ios.m +++ b/src/ios.m @@ -264,7 +264,6 @@ void setupApplication_iOS(void) { selector:@selector(keyboardOffScreen:) name:UIKeyboardWillHideNotification object:nil]; - [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback error:nil]; /* Media player remote controls. */ MPRemoteCommandCenter *commandCenter = [MPRemoteCommandCenter sharedCommandCenter]; [[commandCenter pauseCommand] addTargetWithHandler:^MPRemoteCommandHandlerStatus(MPRemoteCommandEvent * _Nonnull event) { @@ -487,6 +486,8 @@ void init_AVFAudioPlayer(iAVFAudioPlayer *d) { d->player = NULL; d->volume = 1.0f; d->state = initialized_AVFAudioPlayerState; + /* Playback is imminent. */ + [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback error:nil]; } void deinit_AVFAudioPlayer(iAVFAudioPlayer *d) { -- cgit v1.2.3