kAudioSessionProperty_OverrideCategoryDefaultToSpeaker

1 kAudioSessionProperty_OverrideCategoryDefaultToSpeaker

指定,在没有耳机和听筒等输出设备的时候,是否将音频通过扬声器输出;

Discussion
A read/write UInt32 value. By default, the value of this property is FALSE (0).
This property retains its value through an audio route change (such as when plugging in or unplugging a headset), and upon interruption; it reverts to its default value only upon an audio session category change. This property can be used only with the kAudioSessionCategory_PlayAndRecord (or the equivalent playAndRecord) category.
See also kAudioSessionProperty_OverrideAudioRoute.

注意这个属性只支持 category为playandrecord,不支持什么playback之类的;如果你用的不是playandrecord,那当设置这个speaker属性的时候会报错-50;

 

https://developer.apple.com/documentation/audiotoolbox/kaudiosessionproperty_overrideaudioroute

2 kAudioSessionProperty_OverrideAudioRoute

Specifies whether or not to override the audio session category’s typical audio route

A write-only UInt32 value. Can be set with one of two values: kAudioSessionOverrideAudioRoute_None, which specifies that you want to use the typical audio route; and kAudioSessionOverrideAudioRoute_Speaker, when sends output audio to the built-in speaker. This property can be used only with the kAudioSessionCategory_PlayAndRecord (or the equivalent playAndRecord) category.
If a headset is plugged in at the time you set this property’s value to kAudioSessionOverrideAudioRoute_Speaker, the system changes the audio routing for input as well as for output: input comes from the built-in microphone; output goes to the built-in speaker.
Upon an audio route change (such as by plugging in or unplugging a headset), or upon interruption, this property reverts to its default value.

 

posted on   邗影  阅读(113)  评论(0编辑  收藏  举报

相关博文:
阅读排行:
· Ollama——大语言模型本地部署的极速利器
· 使用C#创建一个MCP客户端
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· Windows编程----内核对象竟然如此简单?
· ollama系列1:轻松3步本地部署deepseek,普通电脑可用
历史上的今天:
2017-03-17 Python词云(词频统计,掩膜显示)
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

导航

统计

点击右上角即可分享
微信分享提示