IOS捕获设备和播放设备是否有任何名称或路径?通常我们可以在Windows中获取连接相机及其名称的路径,我想在Mac中我们也可以这样做。任何人都知道如何在IOS上获取捕获和回放设备的名称和路径?
// RETURNS HOW MANY AUDIO CAPTURE DEVICES ARE THERE...
for eg: [[AVCaptureDevice devicesWithMediaType:AVMediaTypeAudio] count];
答案 0 :(得分:3)
NSArray *devices = [AVCaptureDevice devices];
AVCaptureDevice *frontCamera;
AVCaptureDevice *backCamera;
for (AVCaptureDevice *device in devices) {
NSLog(@"Device name: %@", [device localizedName]);
if ([device hasMediaType:AVMediaTypeVideo]) {
if ([device position] == AVCaptureDevicePositionBack) {
NSLog(@"Device position : back");
backCamera = device;
}
else {
NSLog(@"Device position : front");
frontCamera = device;
}
}
}
答案 1 :(得分:0)
你得到设备名称后面的方法
NSString *name =[[UIDevice currentDevice] name]);
答案 2 :(得分:0)
唉,“iOS”中不推荐使用“devices”。请改用AVCaptureDeviceDiscoverySession。