Alternative to deprecated AudioSessionGetProperty, for iOS 7

Custom Bonbons picture Custom Bonbons · Sep 22, 2013 · Viewed 15.4k times · Source

I am using AudioSessionGetProperty to check 'audioIsAlreadyPlaying'. Xcode says: 'AudioSessionGetProperty' is deprecated: first deprecated in iOS 7.0

Please could someone tell me what I should use instead, to get the audioIsAlreadyPlaying property.

AudioSessionGetProperty(kAudioSessionProperty_OtherAudioIsPlaying,
                        &propertySize,
                        &audioIsAlreadyPlaying);
return audioIsAlreadyPlaying;

Answer

Ben S picture Ben S · Sep 22, 2013

Trying using the AVAudioSession's otherAudioPlaying property on iOS 6.0 or higher.

[[AVAudioSession sharedInstance] isOtherAudioPlaying]