Hi Rinoy,It does not work for me. The error I get is:Domain=NSOSStatusErrorDomain Code=560161140 "The operation couldn’t be completed. (OSStatus error 560161140.)" Does your app also turn on the Recording function in the background? Or do you only do Playback?Do you know how to interpret the error code 560161140 more precisely? Richard On Sun, Apr 28, 2013 at 6:21 PM, Rinoy Pazhekattu <email@hidden> wrote: Maybe try doing [audioSession setActive:YES error:&interruptionError];instead and check to if interruptionError is nil. Seems to work for me. RinoyOn Sun, Apr 28, 2013 at 3:27 PM, Richard <email@hidden> wrote: Hi, I am trying to write an audio app that needs to continue when the app is put in the background. I have set the appropriate background modes (both audio and voip), in the plist file and I have a long running thread that wakes up the app every now and then while it is in the background. Most of the time it works. However, there is one case with which I am having a problem.My app receives the interrupt notification when a phone call come in, and then again when the phone call has ended. On the interrupt begin notification, my app's audio operation is automatically suspended and I also call AudioSessionSetActive(false) although I suspect that this may not be necessary. On the interrupt end notification, I attempt to resume the audio operation by calling AudioSessionSetActive(true) and then AudioOutputUnitStart().I have set up my audio interruption handler using AudioSessionInitialize().If the phone call comes in when my app is in the foreground, everything works fine. My app's audio operation gets suspended when the phone call comes in and then resumes when the phone call ends.However, if my app is in the background when the phone call comes in, then when the phone call ends, the call to AudioSessionSetActive(true) fails. If I ignore that failure and try to call AudioOutputUnitStart(), it fails as you would expect, with this message "17:59:46.943 <com.apple.main-thread> AUIOClient_StartIO failed (-12985)" I have tried using a timer and retrying the operation after 20 seconds, but it still fails. Is there any way I can find out what that error number means?If I bring the app back in the foreground and try AudioSessionSetActive(true), then everything resumes working normally. I also tried setting a periodic timer and putting the app in the background. Every time the timer fires, I start an audio operation for a short time and then stop it. In that case, I use AudioOutputUnitStart() and AudioOutputUnitStop() on every timer event. This works fine and no call to AudioSessionSetActive(true) is necessary. As as long as no other audio app runs, my app is able to restart it's audio operation on every timer event.Am I doing something wrong? Is there no way that a background app can resume audio operation after being interrupted by another audio app? Or do I need to do something more than AudioSessionSetActive(true).I was curious to see if other apps do something similar. I looked at one app: Waze. I setup a route and pushed the app into the background and started driving. I confirmed that it does in fact resume after an incoming phone call and it keeps giving voice instructions while still in the background. However, Waze only does playback and my app does recording and I don't know if that distinction matters. Thanks,Richard _______________________________________________ Do not post admin requests to the list. They will be ignored. Coreaudio-api mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden _______________________________________________ Do not post admin requests to the list. They will be ignored. Coreaudio-api mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden _______________________________________________ Do not post admin requests to the list. They will be ignored. Coreaudio-api mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden Follow-Ups: Re: AudioSessionSetActive(true) at end of audio interruption fails when called from background app From: Richard <email@hidden> References: >Re: AudioSessionSetActive(true) at end of audio interruption fails when called from background app (From: Rinoy Pazhekattu <email@hidden>) >Re: AudioSessionSetActive(true) at end of audio interruption fails when called from background app (From: Richard <email@hidden>) Prev by Date: Re: AudioSessionSetActive(true) at end of audio interruption fails when called from background app Next by Date: Re: AudioSessionSetActive(true) at end of audio interruption fails when called from background app Previous by thread: Re: AudioSessionSetActive(true) at end of audio interruption fails when called from background app Next by thread: Re: AudioSessionSetActive(true) at end of audio interruption fails when called from background app Index(es): Date Thread
Maybe try doing [audioSession setActive:YES error:&interruptionError];instead and check to if interruptionError is nil. Seems to work for me. RinoyOn Sun, Apr 28, 2013 at 3:27 PM, Richard <email@hidden> wrote: Hi, I am trying to write an audio app that needs to continue when the app is put in the background. I have set the appropriate background modes (both audio and voip), in the plist file and I have a long running thread that wakes up the app every now and then while it is in the background. Most of the time it works. However, there is one case with which I am having a problem.My app receives the interrupt notification when a phone call come in, and then again when the phone call has ended. On the interrupt begin notification, my app's audio operation is automatically suspended and I also call AudioSessionSetActive(false) although I suspect that this may not be necessary. On the interrupt end notification, I attempt to resume the audio operation by calling AudioSessionSetActive(true) and then AudioOutputUnitStart().I have set up my audio interruption handler using AudioSessionInitialize().If the phone call comes in when my app is in the foreground, everything works fine. My app's audio operation gets suspended when the phone call comes in and then resumes when the phone call ends.However, if my app is in the background when the phone call comes in, then when the phone call ends, the call to AudioSessionSetActive(true) fails. If I ignore that failure and try to call AudioOutputUnitStart(), it fails as you would expect, with this message "17:59:46.943 <com.apple.main-thread> AUIOClient_StartIO failed (-12985)" I have tried using a timer and retrying the operation after 20 seconds, but it still fails. Is there any way I can find out what that error number means?If I bring the app back in the foreground and try AudioSessionSetActive(true), then everything resumes working normally. I also tried setting a periodic timer and putting the app in the background. Every time the timer fires, I start an audio operation for a short time and then stop it. In that case, I use AudioOutputUnitStart() and AudioOutputUnitStop() on every timer event. This works fine and no call to AudioSessionSetActive(true) is necessary. As as long as no other audio app runs, my app is able to restart it's audio operation on every timer event.Am I doing something wrong? Is there no way that a background app can resume audio operation after being interrupted by another audio app? Or do I need to do something more than AudioSessionSetActive(true).I was curious to see if other apps do something similar. I looked at one app: Waze. I setup a route and pushed the app into the background and started driving. I confirmed that it does in fact resume after an incoming phone call and it keeps giving voice instructions while still in the background. However, Waze only does playback and my app does recording and I don't know if that distinction matters. Thanks,Richard _______________________________________________ Do not post admin requests to the list. They will be ignored. Coreaudio-api mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden _______________________________________________ Do not post admin requests to the list. They will be ignored. Coreaudio-api mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
[audioSession setActive:YES error:&interruptionError];
Hi, I am trying to write an audio app that needs to continue when the app is put in the background. I have set the appropriate background modes (both audio and voip), in the plist file and I have a long running thread that wakes up the app every now and then while it is in the background. Most of the time it works. However, there is one case with which I am having a problem.My app receives the interrupt notification when a phone call come in, and then again when the phone call has ended. On the interrupt begin notification, my app's audio operation is automatically suspended and I also call AudioSessionSetActive(false) although I suspect that this may not be necessary. On the interrupt end notification, I attempt to resume the audio operation by calling AudioSessionSetActive(true) and then AudioOutputUnitStart().I have set up my audio interruption handler using AudioSessionInitialize().If the phone call comes in when my app is in the foreground, everything works fine. My app's audio operation gets suspended when the phone call comes in and then resumes when the phone call ends.However, if my app is in the background when the phone call comes in, then when the phone call ends, the call to AudioSessionSetActive(true) fails. If I ignore that failure and try to call AudioOutputUnitStart(), it fails as you would expect, with this message "17:59:46.943 <com.apple.main-thread> AUIOClient_StartIO failed (-12985)" I have tried using a timer and retrying the operation after 20 seconds, but it still fails. Is there any way I can find out what that error number means?If I bring the app back in the foreground and try AudioSessionSetActive(true), then everything resumes working normally. I also tried setting a periodic timer and putting the app in the background. Every time the timer fires, I start an audio operation for a short time and then stop it. In that case, I use AudioOutputUnitStart() and AudioOutputUnitStop() on every timer event. This works fine and no call to AudioSessionSetActive(true) is necessary. As as long as no other audio app runs, my app is able to restart it's audio operation on every timer event.Am I doing something wrong? Is there no way that a background app can resume audio operation after being interrupted by another audio app? Or do I need to do something more than AudioSessionSetActive(true).I was curious to see if other apps do something similar. I looked at one app: Waze. I setup a route and pushed the app into the background and started driving. I confirmed that it does in fact resume after an incoming phone call and it keeps giving voice instructions while still in the background. However, Waze only does playback and my app does recording and I don't know if that distinction matters. Thanks,Richard _______________________________________________ Do not post admin requests to the list. They will be ignored. Coreaudio-api mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
Hi,
I am trying to write an audio app that needs to continue when the app is put in the background. I have set the appropriate background modes (both audio and voip), in the plist file and I have a long running thread that wakes up the app every now and then while it is in the background. Most of the time it works. However, there is one case with which I am having a problem.
My app receives the interrupt notification when a phone call come in, and then again when the phone call has ended. On the interrupt begin notification, my app's audio operation is automatically suspended and I also call AudioSessionSetActive(false) although I suspect that this may not be necessary. On the interrupt end notification, I attempt to resume the audio operation by calling AudioSessionSetActive(true) and then AudioOutputUnitStart().
I have set up my audio interruption handler using AudioSessionInitialize().
If the phone call comes in when my app is in the foreground, everything works fine. My app's audio operation gets suspended when the phone call comes in and then resumes when the phone call ends.
However, if my app is in the background when the phone call comes in, then when the phone call ends, the call to AudioSessionSetActive(true) fails. If I ignore that failure and try to call AudioOutputUnitStart(), it fails as you would expect, with this message "17:59:46.943 <com.apple.main-thread> AUIOClient_StartIO failed (-12985)" I have tried using a timer and retrying the operation after 20 seconds, but it still fails. Is there any way I can find out what that error number means?
If I bring the app back in the foreground and try AudioSessionSetActive(true), then everything resumes working normally.
I also tried setting a periodic timer and putting the app in the background. Every time the timer fires, I start an audio operation for a short time and then stop it. In that case, I use AudioOutputUnitStart() and AudioOutputUnitStop() on every timer event. This works fine and no call to AudioSessionSetActive(true) is necessary. As as long as no other audio app runs, my app is able to restart it's audio operation on every timer event.
Am I doing something wrong? Is there no way that a background app can resume audio operation after being interrupted by another audio app? Or do I need to do something more than AudioSessionSetActive(true).
I was curious to see if other apps do something similar. I looked at one app: Waze. I setup a route and pushed the app into the background and started driving. I confirmed that it does in fact resume after an incoming phone call and it keeps giving voice instructions while still in the background. However, Waze only does playback and my app does recording and I don't know if that distinction matters.
Thanks,
Richard
_______________________________________________ Do not post admin requests to the list. They will be ignored. Coreaudio-api mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden