1

IOS的采集设备和播放设备有没有名字或者路径?通常我们可以在windows中获取连接相机的路径及其名称,我想在Mac中我们也可以做到这一点。任何人都知道如何在 IOS 上获取捕获和播放设备的名称和路径?

  // RETURNS HOW MANY AUDIO CAPTURE DEVICES ARE THERE... 
  for eg: [[AVCaptureDevice devicesWithMediaType:AVMediaTypeAudio] count];
4

3 回答 3

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;
        }
    }
}
于 2012-12-14T10:21:35.290 回答
0

你得到设备名称以下方法

NSString *name =[[UIDevice currentDevice] name]);
于 2012-12-14T09:41:24.790 回答
0

唉,“设备”在 iOS 10.0 中已被弃用。请改用 AVCaptureDeviceDiscoverySession。

于 2017-03-06T20:03:59.607 回答