Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resume after audio interruption #28

Closed
chamrc opened this issue Jun 29, 2013 · 2 comments
Closed

Resume after audio interruption #28

chamrc opened this issue Jun 29, 2013 · 2 comments

Comments

@chamrc
Copy link

chamrc commented Jun 29, 2013

Currently, I'm using the following code but it doesn't seem to work at all.

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(audioInterruptionNotification:) name:AVAudioSessionInterruptionNotification object:nil];

  • (void)audioInterruptionNotification:(NSNotification *) aNotification {
    DLog(@"Interrupt %@", aNotification);
    NSDictionary *dict = [aNotification userInfo];
    NSUInteger typeKey = [[dict objectForKey:@"AVAudioSessionInterruptionTypeKey"] unsignedIntegerValue];
    DLog(@"%d", typeKey == AVAudioSessionInterruptionTypeBegan);
    if (typeKey == AVAudioSessionInterruptionTypeBegan) {
    [_player pause];
    } else {
    [_player resume];
    }
    }

I can see all of the messages printing out in the console but music is not resume for some reason. Is there something that I can do here to fix it? Thanks a lot

@chamrc
Copy link
Author

chamrc commented Jul 3, 2013

Same code works in iOS 7 beta 2. Closed.

@chamrc chamrc closed this as completed Jul 3, 2013
@Zulqarnain-Mustafa
Copy link

Same problem, Music does not resume any solution for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants