Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
https://developer.apple.com/documentation/avfaudio/avaudiosessioncategoryoptions/avaudiosessioncategoryoptionallowairplay

Apple's documentation states that "You can only explicitly set this option if the audio session’s category is set to AVAudioSessionCategoryPlayAndRecord."

Change the code so that it's only explicitly enabled in that specific category.
  • Loading branch information
aardvarkk committed Oct 26, 2023
1 parent a7d1e61 commit dd4429d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions modules/juce_audio_devices/native/juce_Audio_ios.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ struct iOSAudioIODevice::Pimpl final : public AsyncUpdater

static void setAudioSessionCategory (NSString* category)
{
NSUInteger options = AVAudioSessionCategoryOptionAllowAirPlay;
NSUInteger options = 0;

#if ! JUCE_DISABLE_AUDIO_MIXING_WITH_OTHER_APPS
options |= AVAudioSessionCategoryOptionMixWithOthers; // Alternatively AVAudioSessionCategoryOptionDuckOthers
Expand All @@ -285,7 +285,8 @@ struct iOSAudioIODevice::Pimpl final : public AsyncUpdater
if (category == AVAudioSessionCategoryPlayAndRecord)
{
options |= AVAudioSessionCategoryOptionDefaultToSpeaker
| AVAudioSessionCategoryOptionAllowBluetooth;
| AVAudioSessionCategoryOptionAllowBluetooth
| AVAudioSessionCategoryOptionAllowAirPlay;

if (@available (iOS 10.0, *))
options |= AVAudioSessionCategoryOptionAllowBluetoothA2DP;
Expand Down

0 comments on commit dd4429d

Please sign in to comment.