objective-c - iOS7 选择音频输出
PHPz
PHPz 2017-04-21 11:18:07
0
1
909

像native phone那样,如果手机连接了耳机、蓝牙音响的时候,系统会显示三个选项:蓝牙,耳机还是手机。
自己的app要怎么写这个feature?
我知道可以用AVAudioSession.但是它貌似直接帮你按priority做好选择,不知道要怎么能够拿到availableOutputs所有选项?

AVAudioSession* myAudioSession = [AVAudioSession sharedInstance];
[myAudioSession setMode:AVAudioSessionModeVoiceChat error:nil];
[myAudioSession setCategory:AVAudioSessionCategoryPlayAndRecord withOptions:AVAudioSessionCategoryOptionAllowBluetooth error:nil];
[myAudioSession setActive:YES error:nil];
PHPz
PHPz

学习是最好的投资!

reply all(1)
直奔十维

If you want to use a simple Objective-C interface for audio playback and recording, you can use the AV Foundation framework.


If you want to play and record audio with synchronization capabilities, parse audio streams, or convert audio formats, you can use the Audio Toolbox framework.


If you want to connect and use audio processing plug-ins, you can use the Audio Unit framework.


If you want to play back positional audio in games and other applications, you need to use the OpenAL framework. iPhone OS's support for OpenAL 1.1 is based on Core Audio.


If you want to play songs, audio books, or audio podcasts in the iPod library, you need to use the iPod media library access interface in the Media Player framework.


#The Core Audio framework (equivalent to other audio frameworks) provides all data types required by Core Audio services.


Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!