如何取消 AVAudioSession
kAudioSessionProperty_OtherMixableAudioShouldDuck 用于允许将 iPod 音频与应用程序音频混合的音频会话类别,指定当应用程序产生声音时是否应降低 iPod 音频的级别。默认情况下,此属性的值为 FALSE (0)。将其设置为非零值以打开闪避。 我们怎样才能解决这个问题呢?有财产吗?
提前致谢, 钱德拉。
kAudioSessionProperty_OtherMixableAudioShouldDuck is used For audio session categories that allow mixing of iPod audio with application audio, specifies whether iPod audio should be reduced in level when your application produces sound. This property has a value of FALSE (0) by default. Set it to a nonzero value to turn on ducking.
How can we unduck this? Is there any property?
Thanks in advance,
Chandra.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
查看@zaphodtx 发布的示例代码,一种可能的解决方案是激活和停用当前音频会话。
示例中的具体文件为:
https://developer.apple.com/library/ios/samplecode/Breadcrumb/Listings/Breadcrumb_BreadcrumbViewController_m.html#//apple_ref/doc/uid/DTS40010048-Breadcrumb_BreadcrumbViewController_m-DontLinkElementID_6
例如,在斯威夫特:
Looking at the example code posted by @zaphodtx, one possible solution is to activate and deactivate the current audio session.
The specific file in the example is:
https://developer.apple.com/library/ios/samplecode/Breadcrumb/Listings/Breadcrumb_BreadcrumbViewController_m.html#//apple_ref/doc/uid/DTS40010048-Breadcrumb_BreadcrumbViewController_m-DontLinkElementID_6
For example, in Swift:
我也有同样的问题,并且很难让它持续工作。我花了很多时间研究和调试这个问题,最后才给苹果打电话。他们告诉我查看面包屑示例代码。我按照这个例子进行操作,一切正常。
这里的问题是,会话属性和计时等有许多不同的选项。例如,您是否设置属性然后取消设置或保留它然后启动和停止会话?
这是一个类似的问题:
Audio Session "Ducking" Broken in iOS 4... ?
这是苹果的示例代码:
http://developer.apple.com/library/ios/#samplecode/Breadcrumb/Introduction/Intro.html
I had this same question and had trouble getting it to work consistently. I spent a lot of time researching and debugging this and finally just called Apple. They told me to look at the breadcrumb sample code. I followed that example and everything worked fine.
The issue here was that there are many different options for session properties and timing, etc. E.g. do you set the property and then unset it or leave it and then start and stop the session?
Here is a similar question:
Audio Session "Ducking" Broken in iOS 4...?
Here is Apple's sample code:
http://developer.apple.com/library/ios/#samplecode/Breadcrumb/Introduction/Intro.html