当前位置: 首页 > news >正文

AVAudioSessionCategory说明

2019独角兽企业重金招聘Python工程师标准>>> hot3.png


#pragma mark -- Values for the category property --

/*  Use this category for background sounds such as rain, car engine noise, etc.  
 Mixes with other music. */
AVF_EXPORT NSString *const AVAudioSessionCategoryAmbient;
	
/*  Use this category for background sounds.  Other music will stop playing. */
AVF_EXPORT NSString *const AVAudioSessionCategorySoloAmbient;

/* Use this category for music tracks.*/
AVF_EXPORT NSString *const AVAudioSessionCategoryPlayback;

/*  Use this category when recording audio. */
AVF_EXPORT NSString *const AVAudioSessionCategoryRecord;

/*  Use this category when recording and playing back audio. */
AVF_EXPORT NSString *const AVAudioSessionCategoryPlayAndRecord;

/*  Use this category when using a hardware codec or signal processor while
 not playing or recording audio. */
AVF_EXPORT NSString *const AVAudioSessionCategoryAudioProcessing __TVOS_PROHIBITED;

/*  Use this category to customize the usage of available audio accessories and built-in audio hardware.
 For example, this category provides an application with the ability to use an available USB output 
 and headphone output simultaneously for separate, distinct streams of audio data. Use of 
 this category by an application requires a more detailed knowledge of, and interaction with, 
 the capabilities of the available audio routes.  May be used for input, output, or both.
 Note that not all output types and output combinations are eligible for multi-route.  Input is limited
 to the last-in input port. Eligible inputs consist of the following:
	AVAudioSessionPortUSBAudio, AVAudioSessionPortHeadsetMic, and AVAudioSessionPortBuiltInMic.  
 Eligible outputs consist of the following: 
	AVAudioSessionPortUSBAudio, AVAudioSessionPortLineOut, AVAudioSessionPortHeadphones, AVAudioSessionPortHDMI, 
	and AVAudioSessionPortBuiltInSpeaker.  
 Note that AVAudioSessionPortBuiltInSpeaker is only allowed to be used when there are no other eligible 
 outputs connected.  */
AVF_EXPORT NSString *const AVAudioSessionCategoryMultiRoute NS_AVAILABLE_IOS(6_0);

AVAudioSessionCategoryAmbient 或 kAudioSessionCategory_AmbientSound

用于非以语音为主的应用,使用这个category的应用会随着静音键和屏幕关闭而静音。并且不会中止其它应用播放声音,可以和其它自带应用如iPod,safari等同时播放声音。注意:该Category无法在后台播放声音

 AVAudioSessionCategorySoloAmbient 或 kAudioSessionCategory_SoloAmbientSound

 类似于AVAudioSessionCategoryAmbient 不同之处在于它会中止其它应用播放声音。 这个category为默认category。该Category无法在后台播放声音

 AVAudioSessionCategoryPlayback 或 kAudioSessionCategory_MediaPlayback

 用于以语音为主的应用,使用这个category的应用不会随着静音键和屏幕关闭而静音。可在后台播放声音

 AVAudioSessionCategoryRecord 或 kAudioSessionCategory_RecordAudio

 用于需要录音的应用,设置该category后,除了来电铃声,闹钟或日历提醒之外的其它系统声音都不会被播放。该Category只提供单纯录音功能。

 AVAudioSessionCategoryPlayAndRecord 或 kAudioSessionCategory_PlayAndRecord

 用于既需要播放声音又需要录音的应用,语音聊天应用(如微信)应该使用这个category。该Category提供录音和播放功能。如果你的应用需要用到iPhone上的听筒,该category是你唯一的选择,在该Category下声音的默认出口为听筒(在没有外接设备的情况下)。

AVAudioSessionCategoryAudioProcessing

使用硬件解码器处理音频,该音频会话使用期间,不能播放或录音

这个类别用于音频处理,比如编码解码时/不播放音频/未录音时使用。设置了这种模式,你在应用中就不能播放和录制任何声音。调用AVAPlayerprepareToPlayplay方法都将返回false。其他应用的音频也会在此模式下停止。

AVAudioSessionCategoryMultiRoute

这个类别可以实现同时可以有多种输出,例如:usb和耳机同时输出,但并非所有输入输出方式均支持.输入方式仅包括:AVAudioSessionPortUSBAudio/AVAudioSessionPortHeadsetMic AVAudioSessionPortBuiltInMic;输出仅包括:AVAudioSessionPortUSBAudio /AVAudioSessionPortLineOut /AVAudioSessionPortHeadphones /AVAudioSessionPortHDMI AVAudioSessionPortBuiltInSpeaker

184825_7LhF_2334416.jpg

 注意:并不是一个应用只能使用一个category,程序应该根据实际需要来切换设置不同的category,举个例子,录音的时候,需要设置为AVAudioSessionCategoryRecord,当录音结束时,应根据程序需要更改category为AVAudioSessionCategoryAmbient,AVAudioSessionCategorySoloAmbient或AVAudioSessionCategoryPlayback中的一种。


转载于:https://my.oschina.net/ospost90s/blog/654929

相关文章:

  • 一个Android项目多线程下载模块开源库:AndroidFileDownloader
  • Azkaban的Web Server源码探究系列12: 首页之前的跳转
  • 学习之路-现代密码学基础-001
  • 使用hadoop实现关联商品统计
  • 链表的逆置
  • 帧间提取水印
  • 面试遇到的一些题
  • Charles中如何对https抓包
  • 大家一起和snailren学java-(13)字符串
  • 九、搭建织梦cms网站
  • I.MX6 driver goto 使用
  • wcf系列学习5天速成——第四天 wcf之分布式架构
  • 【HBase】start master 与 start master --backup 的区别
  • 【Mongodb】如何创建mongodb的replica set
  • ti processor sdk linux am335x evm /bin/setup-host-check.sh hacking
  • 【Redis学习笔记】2018-06-28 redis命令源码学习1
  • Joomla 2.x, 3.x useful code cheatsheet
  • Linux编程学习笔记 | Linux多线程学习[2] - 线程的同步
  • MySQL QA
  • Redis学习笔记 - pipline(流水线、管道)
  • Redis在Web项目中的应用与实践
  • storm drpc实例
  • TypeScript实现数据结构(一)栈,队列,链表
  • vue-cli在webpack的配置文件探究
  • 从零搭建Koa2 Server
  • 基于web的全景—— Pannellum小试
  • 基于阿里云移动推送的移动应用推送模式最佳实践
  • 实战:基于Spring Boot快速开发RESTful风格API接口
  • 说说动画卡顿的解决方案
  • 一个普通的 5 年iOS开发者的自我总结,以及5年开发经历和感想!
  • 资深实践篇 | 基于Kubernetes 1.61的Kubernetes Scheduler 调度详解 ...
  • ​软考-高级-系统架构设计师教程(清华第2版)【第9章 软件可靠性基础知识(P320~344)-思维导图】​
  • !!java web学习笔记(一到五)
  • # MySQL server 层和存储引擎层是怎么交互数据的?
  • # Python csv、xlsx、json、二进制(MP3) 文件读写基本使用
  • # 计算机视觉入门
  • #Linux(make工具和makefile文件以及makefile语法)
  • #pragma multi_compile #pragma shader_feature
  • (1)虚拟机的安装与使用,linux系统安装
  • (2015)JS ES6 必知的十个 特性
  • (vue)el-checkbox 实现展示区分 label 和 value(展示值与选中获取值需不同)
  • (免费领源码)Java#Springboot#mysql农产品销售管理系统47627-计算机毕业设计项目选题推荐
  • (十八)devops持续集成开发——使用docker安装部署jenkins流水线服务
  • (一)u-boot-nand.bin的下载
  • (原)Matlab的svmtrain和svmclassify
  • (原創) X61用戶,小心你的上蓋!! (NB) (ThinkPad) (X61)
  • (转) Android中ViewStub组件使用
  • (转)JAVA中的堆栈
  • .NET Framework 3.5中序列化成JSON数据及JSON数据的反序列化,以及jQuery的调用JSON
  • .NET Framework与.NET Framework SDK有什么不同?
  • .NET Standard、.NET Framework 、.NET Core三者的关系与区别?
  • .NET 读取 JSON格式的数据
  • @Responsebody与@RequestBody
  • [ C++ ] STL_vector -- 迭代器失效问题
  • [ vulhub漏洞复现篇 ] Celery <4.0 Redis未授权访问+Pickle反序列化利用