Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AudioQueueStart fails when iphone app running in background iOS4.0

I'm having difficulties starting the AudioQueue when my app is in the background with iOS4.0 The code works fine when the app is active, but fails with -12985 code when running in the background.

        err = AudioQueueStart( queueObject, NULL );


        if( err )
        {
            NSLog(@"AudioQueueStart failed with %d", err);
                = NO;
AudioQueueStop(queueObject, YES);
            return;
        }

For the code above, err is set to -12985

like image 591
dquail Avatar asked Jun 25 '10 22:06

dquail


1 Answers

Making sure that my AudioSession was active fixed the problem: Previously in code I had set the session to inactive between song changes before starting a new song:

AudioSessionSetActive(false);

Once I removed this AudioQueueStart works just fine from the background.

like image 147
dquail Avatar answered Nov 11 '22 17:11

dquail