AVAudioSessionInterruptionNotification不会触发时捕获设备活跃 [英] AVAudioSessionInterruptionNotification not triggered when capture device active

查看:2669
本文介绍了AVAudioSessionInterruptionNotification不会触发时捕获设备活跃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在iOS 7.0.4有一个问题的 AVAudioSessionInterruptionNotification 。结果
我注册了它的NSNotificationCenter,我激活AVAudioSession。
一切工作正常,但如果摄像机被激活,该特定通知不再被触发,既不中断的开始,也不是结束吧。结果
我通过接收上iPhone4的电池通话,也可以通过该应用程序正在运行,同时使报警环测试音频中断。
我使用的AVCam通知还试图示例应用程序和我有同样的问题。结果
什么是音频中断和激活相机之间的关系?为什么会在摄像机开启停止被触发音频中断?难道这是一个iOS的错误?

I'm having a problem with "AVAudioSessionInterruptionNotification" on iOS 7.0.4.
I sign up for it on the NSNotificationCenter, and I activate AVAudioSession. Everything works fine, but if a camera is activated, that particular notification is not triggered anymore, neither for the beginning of an interruption, nor for the end of it.
I test audio interruptions by receiving cell calls on an iPhone4, and also by making an alarm ring while the app is running. I also tried using the notification with the "AVCam" sample app, and I have the same problem.
What is the relationship between audio interruptions and camera activation? Why would audio interruptions stop being triggered if a camera is turned on? Could this be an iOS bug?

编辑2014年1月10日:我更新到iOS 7.1的Beta 3,这个问题仍是present

Edit jan 10, 2014: I updated to iOS 7.1 beta 3, and the problem is still present.

感谢您。

推荐答案

设置相机/捕获设备对象的属性usesApplicationAudioSession为NO,一切都会好起来。

set the camera/capture device object property usesApplicationAudioSession to NO and all will be fine

您可以使用AVCaptureSession:

You can use AVCaptureSession:

captureSession = [[AVCaptureSession alloc] init];
...
captureSession.usesApplicationAudioSession = NO;

这篇关于AVAudioSessionInterruptionNotification不会触发时捕获设备活跃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆