How to prevent my app from closing the user's currently playing music?
When i launch my iphone application the music that's currently playing from the iphone is stopped; how can i prevent this behaviour?
Use AudioSessionSetProperty() and choose an kAudioSessionCategory_ that doesn't stop music playback such as kAudioSessionCategory_UserInterfaceSoundEffects and then it'll play them both at the same time.
Is that what you're looking to do?
Is that what you're looking to do?
bruss14 Wrote:Use AudioSessionSetProperty() and choose an kAudioSessionCategory_ that doesn't stop music playback such as kAudioSessionCategory_UserInterfaceSoundEffects and then it'll play them both at the same time.
Is that what you're looking to do?
Well, i tried doing it like this:
AudioSessionInitialize(NULL, NULL, NULL, self);
UInt32 sessionCategory = kAudioSessionCategory_AmbientSound;
AudioSessionSetProperty(kAudioSessionProperty_AudioCategory, sizeof(sessionCategory), &sessionCategory);
AudioSessionSetActive(true);
but it does not work. I am playing sounds with OpenAL and when my app launches it still stops the current track played from the ipod library.
I've found this to be touchy in OS 3.x depending where and when you initialize OpenAL. Try this order:
AudioSessionInitialize
AudioSessionSetProperty
Init OpenAL (alcOpenDevice, alcCreateContext, alcMakeContextCurrent, etc.)
AudioSessionSetActive
AudioSessionInitialize
AudioSessionSetProperty
Init OpenAL (alcOpenDevice, alcCreateContext, alcMakeContextCurrent, etc.)
AudioSessionSetActive
Frank C. Wrote:I've found this to be touchy in OS 3.x depending where and when you initialize OpenAL. Try this order:
AudioSessionInitialize
AudioSessionSetProperty
Init OpenAL (alcOpenDevice, alcCreateContext, alcMakeContextCurrent, etc.)
AudioSessionSetActive
Thanks, it finally worked!
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| Slowdown while playing many OpenAL sounds and accessing AVAudioPlayer.playing | Rasterman | 6 | 4,685 |
Aug 31, 2010 09:46 PM Last Post: headkaze |
|
| Playing sounds and music on iPhone, which API to use? | Jamie W | 17 | 8,245 |
Apr 20, 2010 07:55 AM Last Post: Beast |
|
| Prevent 3rd party lib from messing up gl | kendric | 6 | 3,729 |
Sep 15, 2009 06:56 PM Last Post: kendric |
|
| Prevent screen from dimming during game | npatrick6 | 3 | 3,254 |
May 22, 2009 10:22 PM Last Post: AnotherJake |
|
| Prevent iPhone SnapShot? | Graphic Ace | 5 | 3,299 |
Mar 29, 2009 08:49 AM Last Post: Graphic Ace |
|

