小编luc*_*ico的帖子

列出可用的输出音频目标AVAudioSession

我需要列出iOS应用程序可用的音频输出.我的问题与此类似:如何在iOS上列出可用的音频输出路径

我试过这段代码:

NSError *setCategoryError = nil;
BOOL success = [[AVAudioSession sharedInstance] setCategory: AVAudioSessionCategoryPlayback
                                                      error: &setCategoryError];

NSError *activationError = nil;
[[AVAudioSession sharedInstance] setActive: YES error: &activationError];

…
NSLog(@"session.currentRoute.outputs count %d", [[[[AVAudioSession sharedInstance] currentRoute] outputs ] count]);
for (AVAudioSessionPortDescription *portDesc in [[[AVAudioSession sharedInstance] currentRoute] outputs ]) {
    NSLog(@"-----");
    NSLog(@"portDesc UID %@", portDesc.UID);
    NSLog(@"portDesc portName %@", portDesc.portName);
    NSLog(@"portDesc portType %@", portDesc.portType);
    NSLog(@"portDesc channels %@", portDesc.channels);
}
Run Code Online (Sandbox Code Playgroud)

但是我总是看到一个输出端口(计数是1),如果我有两个(Airplay和内置扬声器).如果我使用音乐应用程序,我可以看到两个端口并在它们之间切换.在我的应用程序中,我只看到我选择的那个.

我还需要做些什么吗?

谢谢

编辑:

我也试过这个代码:

CFDictionaryRef asCFType = nil;
UInt32 dataSize = sizeof(asCFType);
AudioSessionGetProperty(kAudioSessionProperty_AudioRouteDescription, &dataSize, &asCFType); …
Run Code Online (Sandbox Code Playgroud)

objective-c ios avaudiosession airplay

27
推荐指数
1
解决办法
1万
查看次数

AVFoundation人脸检测可以定位眼睛和嘴巴的位置吗?

使用 CoreImage 人脸检测时,我得到具有眼睛和嘴巴位置属性的 CIFaceFeature 对象。当使用 AVFoundation 和 AVMetadataObjectTypeFace 作为 metadataObjectTypes 时,我得到具有偏航和滚动角度属性的 AVMetadataFaceObject。

使用 AVFoundation 时有没有办法获得眼睛和嘴巴的位置?

谢谢

avfoundation face-detection ios

5
推荐指数
1
解决办法
1371
查看次数