Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - (void)handleAudioSessionInterruption:(NSNotification *)notification
- {
- NSNumber *interruptionType = [[notification userInfo] objectForKey:AVAudioSessionInterruptionTypeKey];
- NSNumber *interruptionOption = [[notification userInfo] objectForKey:AVAudioSessionInterruptionOptionKey];
- switch (interruptionType.unsignedIntegerValue)
- {
- case AVAudioSessionInterruptionTypeBegan:
- {
- [_instreamAudioAd pause];
- break;
- }
- case AVAudioSessionInterruptionTypeEnded:
- {
- if (interruptionOption.unsignedIntegerValue == AVAudioSessionInterruptionOptionShouldResume)
- {
- dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^{
- [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategorySoloAmbient error:nil];
- [[AVAudioSession sharedInstance] setActive:YES error:nil];
- dispatch_async(dispatch_get_main_queue(), ^{
- [_instreamAudioAd resume];
- });
- });
- }
- break;
- }
- default:
- break;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement