views:

240

answers:

1

Hi

I need to find out if my program is currently playing any audio and in case it does, I want to stop the previous audio and start a new playback. The property kAudioSessionProperty_OtherAudioIsPlaying always returns a 0 (probably only checks whether iPod music is playing) There's another property kAudioQueueProperty_IsRunning but this always returns a 0 whether the audio is running or not. Can someone please tell me how I can find out if an audio is playing in my app or not.

Thanks.

Note: The class from which I invoke my streamer gets deallocated when I move back in the view hierarchy. So I do not have any way of accessing the AudioFileStreamID to know whether audio is playing. I need to use one of the properties provided by the SDK.

A: 

Found a workaround. Instead of creating the streamer object in a viewcontroller, I am using a reference in the appDelegate. This way I'll always have a live reference of the streamer class which I can access in any of the viewcontrollers to know whether audio is currently playing or not.

lostInTransit