iOS 音频打断事件的处理
来源:互联网 发布:深圳赛维网络董事长 编辑:程序博客网 时间:2024/06/05 00:51
// // 监听音频打断事件 // setup our audio session AVAudioSession *sessionInstance = [AVAudioSession sharedInstance]; // add interruption handler [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(audioSessionWasInterrupted:) name:AVAudioSessionInterruptionNotification object:sessionInstance]; NSError *error = nil; [sessionInstance setCategory:AVAudioSessionCategoryPlayback error:&error]; if(nil != error) NSLog(@"Error setting audio session category! %@", error); else { [sessionInstance setActive:YES error:&error]; if (nil != error) NSLog(@"Error setting audio session active! %@", error); }
- (void)audioSessionWasInterrupted:(NSNotification *)notification{ NSLog(@"the notification is %@",notification); if (AVAudioSessionInterruptionTypeBegan == [notification.userInfo[AVAudioSessionInterruptionTypeKey] intValue]) { NSLog(@"begin"); } else if (AVAudioSessionInterruptionTypeEnded == [notification.userInfo[AVAudioSessionInterruptionTypeKey] intValue]) { NSLog(@"begin - end"); }}
Apple Demo
https://developer.apple.com/library/prerelease/content/samplecode/MusicCube/Introduction/Intro.html
AVAudioSessionCategory说明
http://blog.sina.com.cn/s/blog_7ea0400d0102vjur.html
AVAudioSessionCategoryAm
用于非以语音为主的应用,使用这个category的应用会随着静音键和屏幕关闭而静音。并且不会中止其它应用播放声音,可以和其它自带应用如iPod,safari等同时播放声音。注意:该Category无法在后台播放声音
0 0
- iOS 音频打断事件的处理
- interruptionListener iOS 音频打断处理
- iOS 音频被打断恢复
- iOS播放音乐文件时的操作和打断处理
- iOS播放音乐文件时的操作和打断处理
- IOS-手机来电或者第三方音频打断当前播放
- iOS音频的后台播放总结(后台网络请求歌曲,Remote控制,锁屏封面,各种打断)
- iOS音频的后台播放总结(后台网络请求歌曲,Remote控制,锁屏封面,各种打断)
- iOS音频的后台播放总结(后台网络请求歌曲,Remote控制,锁屏封面,各种打断)
- iOS音频的后台播放总结(后台网络请求歌曲,Remote控制,锁屏封面,各种打断)
- iOS音频的后台播放总结(后台网络请求歌曲,Remote控制,锁屏封面,各种打断)
- iOS音频的后台播放总结(后台网络请求歌曲,Remote控制,锁屏封面,各种打断)
- button的touch事件被打断
- iOS 的事件处理
- ios处理播放音频时的中断
- ios好的音频处理代码
- IOS非常有用的音频处理库
- 苹果ios音频的回声消除处理
- 利用openoffice将doc、docx转为pdf
- python+telnetlib重启普联TL-ER5520G路由
- setting中打开自动旋转功能和接收sensor数据分析
- 2016年个人总结社区版
- Java多线程编程核心技术第三章笔记
- iOS 音频打断事件的处理
- sql获取时间段
- 打造 Recyclerview 的万能 Holder CommonHolder
- 英语前缀总结
- Leetcode 32 - Longest Valid Parentheses(线性dp)
- Zookeeper Api(java)入门与应用
- js对象克隆或复制
- 年度总结
- G++ 编译结果优化方式!!!!!