在一种情况下未调用 kAudioSessionProperty_AudioRouteChange 的回调

发布于 2024-09-28 04:50:11 字数 375 浏览 0 评论 0原文

我希望在插入或拔出耳机时收到通知。我目前正在使用这样的属性监听器来执行此操作:

AudioSessionAddPropertyListener (kAudioSessionProperty_AudioRouteChange, myCallback, self);

这在所有情况下都工作得很好,除了一种情况,它是这样的:

  1. 启动,iPhone 未静音,未插入耳机 打开
  2. 静音按钮:调用回调,良好
  3. 现在插入耳机:未调用回调,不好

我还应该考虑其他房产吗?是否存在我不知道的涉及静音按钮的特殊情况?

我使用的是 iPhone 3GS 和 iOS 4.1。

非常感谢您的帮助! 帕特里克

I want to be notified if headphones are plugged in or plugged out. I'm currently doing this using a property listener like this:

AudioSessionAddPropertyListener (kAudioSessionProperty_AudioRouteChange, myCallback, self);

This works perfectly well in all cases except in one, it goes like this:

  1. Launch, iPhone is unmuted, no headphones plugged in
  2. Switch the mute button on: The callback is called, good
  3. Plug in the headphones now: Callback is not called, not good

Is there another property I should consider? Is there a special case involving the mute button I'm not aware of?

I'm using an iPhone 3GS and iOS 4.1.

Thanks a lot for any help!
Patrick

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

冷情妓 2024-10-05 04:50:11

仅当使用受静音开关影响的音频会话类别(例如 kAudioSessionCategory_SoloAmbientSound)时,才会发生此错误/功能。例如,kAudioSessionCategory_MediaPlayback 按预期工作。

This bug/feature only happens when using an audio session category affected by the silent switch (e.g. kAudioSessionCategory_SoloAmbientSound). kAudioSessionCategory_MediaPlayback for example works as expected.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文