IOS的采集设备和播放设备有没有名字或者路径?通常我们可以在windows中获取连接相机的路径及其名称,我想在Mac中我们也可以做到这一点。任何人都知道如何在 IOS 上获取捕获和播放设备的名称和路径?
// RETURNS HOW MANY AUDIO CAPTURE DEVICES ARE THERE...
for eg: [[AVCaptureDevice devicesWithMediaType:AVMediaTypeAudio] count];
IOS的采集设备和播放设备有没有名字或者路径?通常我们可以在windows中获取连接相机的路径及其名称,我想在Mac中我们也可以做到这一点。任何人都知道如何在 IOS 上获取捕获和播放设备的名称和路径?
// RETURNS HOW MANY AUDIO CAPTURE DEVICES ARE THERE...
for eg: [[AVCaptureDevice devicesWithMediaType:AVMediaTypeAudio] count];
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;
}
}
}
你得到设备名称以下方法
NSString *name =[[UIDevice currentDevice] name]);
唉,“设备”在 iOS 10.0 中已被弃用。请改用 AVCaptureDeviceDiscoverySession。