Find if audio is currently playing

I need to find out if my program is playing any sound, and if it does, I want to stop the previous sound and start a new one. KAudioSessionProperty_OtherAudioIsPlaying always returns 0 (maybe just checks if iPod music is playing) There's another property kAudioQueueProperty_IsRunning, but this always returns 0 whether audio is working or not. Can someone please tell me how can I know if audio is playing in my application or not.

Thank.

Note. The class I am calling my streamer from is freed when I return to the view hierarchy. So I don't have access to the AudioFileStreamID to see if the sound is playing. I need to use one of the properties provided by the SDK.

+1


source to share


1 answer


Workaround found. Instead of creating a streamer object in the view controller, I am using a link in appDelegate. This way I will always have a live streamer class link that I can access from in any of the view controllers to see if the sound is currently playing or not.



0


source







All Articles