检测(听)音频路由变化在iOS中7 [英] Detect (listen to) audio route change in iOS 7

查看:425
本文介绍了检测(听)音频路由变化在iOS中7的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

刚开始开发针对iOS 7,发现AudioSession相关的功能和PropertyListeners在iOS的7 pcated德$ P $

Just starting development for iOS 7, and found that AudioSession related functions and PropertyListeners are deprecated in iOS 7.

在我用下面的方法来检测,如果耳机已经被插入或从设备拔出:

Before I use the following method to detect if a headset has been plugged in or unplugged from the device:

    /* add callback for device route change */
    AudioSessionAddPropertyListener (
                                     kAudioSessionProperty_AudioRouteChange,
                                     audioRouteChangeListenerCallback,
                                     (__bridge void *)(self));

然后实现监听器回调做不同的事情,内部的算法。现在的iOS 7日precated它并没有单证上的任何选择,是否有由专家在这里的任何解决方案?谢谢!

Then implement the listener callback to do different things to the internal algorithms. Now iOS 7 deprecated it and there's no documentations on any alternative, Is there any solutions by experts here? Thanks!

推荐答案

办理通知AVAudioSessionRouteChangeNotification(提供的iOS 6.0或更高版本)。

handle the notification AVAudioSessionRouteChangeNotification (Available in iOS 6.0 and later.)

这篇关于检测(听)音频路由变化在iOS中7的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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