我想知道是否可以将AVAudioPlayer指定为AVAudioSession的输入设备。我想通过麦克风通过VoIP应用程序播放声音,让另一方听到,即使可能,我也不知道该如何处理。
感谢任何帮助,文档模糊不清,我知道这不是洁净编程,谢谢。
最佳答案
不,如果您进入AVAudioSession.h头文件(或Apple文档),您将看到可用的输入/输出端口列表。除此之外,Apple不想让您有能力从其他应用程序中窃取音乐>)
#pragma mark -- constants for port types --
/* input port types */
AVF_EXPORT NSString *const AVAudioSessionPortLineIn NS_AVAILABLE_IOS(6_0); /* Line level input on a dock connector */
AVF_EXPORT NSString *const AVAudioSessionPortBuiltInMic NS_AVAILABLE_IOS(6_0); /* Built-in microphone on an iOS device */
AVF_EXPORT NSString *const AVAudioSessionPortHeadsetMic NS_AVAILABLE_IOS(6_0); /* Microphone on a wired headset. Headset refers to an
accessory that has headphone outputs paired with a
microphone. */
/* output port types */
AVF_EXPORT NSString *const AVAudioSessionPortLineOut NS_AVAILABLE_IOS(6_0); /* Line level output on a dock connector */
AVF_EXPORT NSString *const AVAudioSessionPortHeadphones NS_AVAILABLE_IOS(6_0); /* Headphone or headset output */
AVF_EXPORT NSString *const AVAudioSessionPortBluetoothA2DP NS_AVAILABLE_IOS(6_0); /* Output on a Bluetooth A2DP device */
AVF_EXPORT NSString *const AVAudioSessionPortBuiltInReceiver NS_AVAILABLE_IOS(6_0); /* The speaker you hold to your ear when on a phone call */
AVF_EXPORT NSString *const AVAudioSessionPortBuiltInSpeaker NS_AVAILABLE_IOS(6_0); /* Built-in speaker on an iOS device */
AVF_EXPORT NSString *const AVAudioSessionPortHDMI NS_AVAILABLE_IOS(6_0); /* Output via High-Definition Multimedia Interface */
AVF_EXPORT NSString *const AVAudioSessionPortAirPlay NS_AVAILABLE_IOS(6_0); /* Output on a remote Air Play device */
AVF_EXPORT NSString *const AVAudioSessionPortBluetoothLE NS_AVAILABLE_IOS(7_0); /* Output on a Bluetooth Low Energy device */
/* port types that refer to either input or output */
AVF_EXPORT NSString *const AVAudioSessionPortBluetoothHFP NS_AVAILABLE_IOS(6_0); /* Input or output on a Bluetooth Hands-Free Profile device */
AVF_EXPORT NSString *const AVAudioSessionPortUSBAudio NS_AVAILABLE_IOS(6_0); /* Input or output on a Universal Serial Bus device */
AVF_EXPORT NSString *const AVAudioSessionPortCarAudio NS_AVAILABLE_IOS(7_0); /* Input or output via Car Audio */
关于ios - 将AVAudioPlayer设置为AVAudioSession的输入数据源,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/24391118/