Reputation: 3301
Does IOS capture devices and playback devices have any name or path? Usually we can able to get path for connected camera and its name in windows, I guess in Mac also we can do that. Anyone have idea about how to get name and path of capture and playback devices on IOS?
// RETURNS HOW MANY AUDIO CAPTURE DEVICES ARE THERE...
for eg: [[AVCaptureDevice devicesWithMediaType:AVMediaTypeAudio] count];
Upvotes: 1
Views: 1395
Reputation: 643
Alas, "devices" is deprecated in iOS 10.0. Use AVCaptureDeviceDiscoverySession instead.
Upvotes: 0
Reputation: 3301
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;
}
}
}
Upvotes: 3
Reputation: 3901
you get device name follwing method
NSString *name =[[UIDevice currentDevice] name]);
Upvotes: 0