2021-02-19 08:28:05 -07:00
|
|
|
//
|
|
|
|
// AVCaptureDevice+physicalDevices.swift
|
2021-06-21 14:42:46 -06:00
|
|
|
// mrousavy
|
2021-02-19 08:28:05 -07:00
|
|
|
//
|
|
|
|
// Created by Marc Rousavy on 10.01.21.
|
2021-06-01 05:07:57 -06:00
|
|
|
// Copyright © 2021 mrousavy. All rights reserved.
|
2021-02-19 08:28:05 -07:00
|
|
|
//
|
|
|
|
|
|
|
|
import AVFoundation
|
|
|
|
|
|
|
|
extension AVCaptureDevice {
|
|
|
|
/**
|
|
|
|
If the device is a virtual multi-cam, this returns `constituentDevices`, otherwise this returns an array of a single element, `self`
|
|
|
|
*/
|
|
|
|
var physicalDevices: [AVCaptureDevice] {
|
|
|
|
if #available(iOS 13.0, *), isVirtualDevice {
|
|
|
|
return self.constituentDevices
|
|
|
|
} else {
|
|
|
|
return [self]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|