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;
}
}
}
How to get the iOS devices camera name?
-
08-12-2021 - |
質問
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];
解決
他のヒント
you get device name follwing method
NSString *name =[[UIDevice currentDevice] name]);
Alas, "devices" is deprecated in iOS 10.0. Use AVCaptureDeviceDiscoverySession instead.
所属していません StackOverflow