I was using AVPlayer to play online mp3 stream ! When I pause the player
[AVPlayer pause];
AVAudioSession *session = [AVAudioSession sharedInstance];
session.delegate = nil;
NSError *error = nil;
[session setActive:NO error:&error];
NSLog([error description]);
I met the error , Error Domain=NSOSStatusErrorDomain Code=560030580 "The operation couldn’t be completed. (OSStatus error 560030580.)"
Can anyone tell me why and how to resolve it?
Thank you very much!!
I encounter this problem too. I googled and see this post more than one time. From the forum, someone said, the error code can be figured out by AVAudioSession.h
.
In my case, the problem seems to be race condition
problem. It never happens on my iPhone 5s
, but happens on other devices generally, ex: iPhone6 Plus
.
As far as I know, the error code 560030580
means AVAudioSessionErrorCodeIsBusy
.
From AVAudioSession.h
, the following is defined.
typedef NS_ENUM(NSInteger, AVAudioSessionErrorCode)
{
AVAudioSessionErrorCodeNone = 0,
AVAudioSessionErrorCodeMediaServicesFailed = 'msrv', /* 0x6D737276, 1836282486 */
AVAudioSessionErrorCodeIsBusy = '!act', /* 0x21616374, 560030580 */
AVAudioSessionErrorCodeIncompatibleCategory = '!cat', /* 0x21636174, 560161140 */
AVAudioSessionErrorCodeCannotInterruptOthers = '!int', /* 0x21696E74, 560557684 */
AVAudioSessionErrorCodeMissingEntitlement = 'ent?', /* 0x656E743F, 1701737535 */
AVAudioSessionErrorCodeSiriIsRecording = 'siri', /* 0x73697269, 1936290409 */
AVAudioSessionErrorCodeCannotStartPlaying = '!pla', /* 0x21706C61, 561015905 */
AVAudioSessionErrorCodeCannotStartRecording = '!rec', /* 0x21726563, 561145187 */
AVAudioSessionErrorCodeBadParam = -50,
AVAudioSessionErrorInsufficientPriority = '!pri', /* 0x21707269, 561017449 */
AVAudioSessionErrorCodeResourceNotAvailable = '!res', /* 0x21726573, 561145203 */
AVAudioSessionErrorCodeUnspecified = 'what' /* 0x77686174, 2003329396 */
} NS_AVAILABLE_IOS(7_0);
According to Apple https://developer.apple.com/documentation/avfoundation/avaudiosession/1616597-setactive :
Deactivating an audio session that has running audio objects stops them, deactivates the session, and returns an AVAudioSessionErrorCodeIsBusy error.
As far as I understand it means that your audio is still playing and you try to deactivate the session - it will be deactivated but you will be noted this way about that fact.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With