kstenerud / ObjectAL-for-iPhone

Mac and iOS Audio development, minus the headache. ObjectAL is the easy Objective-C interface to OpenAL, AVAudioPlayer, and audio session management.
http://kstenerud.github.com/ObjectAL-for-iPhone
885 stars 171 forks source link

Stop the music currently playing on iOS 7 #59

Closed ghost closed 11 years ago

ghost commented 11 years ago

At launch, app must not stop the music currently playing.

It work well on iOS 6 but on iOS 7. The first time a method is invoke with singleton the music is stopped.

ghost commented 11 years ago

if I then leave the app (not stopping it) to restart music and go back to it, the behavior is OK : music still playing !

ghost commented 11 years ago

After a debugging session I have that music stop playing right after invocation of alcOpenDevice:

 (NSString*) deviceName
{
    ALCdevice* device;
    @synchronized(self)
    {
        device = alcOpenDevice([deviceName UTF8String]);
        if(NULL == device)
        {
            OAL_LOG_ERROR(@"Could not open device %@", deviceName);
        }
    }
    return device;
}

ALWrapper.m:277

Bug appear on an iPod 5G running iOS 7.0.2 I will give some other tests on another device, an iPad mini.

ghost commented 11 years ago

Same behavior on iPad mini running iOS 7.0.2

commanda commented 11 years ago

My workaround, for the time being, is to set my desired audio session category up front, before instantiating the [OALSimpleAudio sharedInstance].

[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryAmbient error:&error];
ghost commented 11 years ago

Ok it works fine now ! Thank you.