Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Alternative to deprecated AudioSessionGetProperty, for iOS 7

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;
like image 628
Custom Bonbons Avatar asked Sep 22 '13 16:09

Custom Bonbons


2 Answers

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

[[AVAudioSession sharedInstance] isOtherAudioPlaying]

like image 105
Ben S Avatar answered Oct 31 '22 23:10

Ben S


The AVAudioSession class replaces deprecated AudioSession APIs. For what you're doing, see the otherAudioPlaying property.

like image 45
rickster Avatar answered Oct 31 '22 23:10

rickster