On macOS, is it possible to see a virtual Camera, such as OBS, as a CaptureDevice? I see that, for example, Google Chrome or Zoom can use this camera, but using AVCaptureDevice.DiscoverySession I am unable to see it.
Am I doing wrong?
var deviceTypes: [AVCaptureDevice.DeviceType] = [.builtInMicrophone, .builtInWideAngleCamera]
#if os(OSX)
deviceTypes.append(.externalUnknown)
#else
deviceTypes.append(contentsOf: [.builtInDualCamera,
.builtInDualWideCamera,
.builtInTelephotoCamera,
.builtInTripleCamera,
.builtInTrueDepthCamera,
.builtInUltraWideCamera])
#endif
let discoverySession = AVCaptureDevice.DiscoverySession(deviceTypes: deviceTypes,
mediaType: nil, position: .unspecified)
result = discoverySession.devices.map { device in
device.localizedName
}
This could be related to the Hardened Runtime and library validation.
macOS does no longer load frameworks or plug-ins that are signed with 3rd party credentials when library validation is turned on. This is part of the Hardened Runtime, which is now enabled per default. Don't know about OBS, but virtual capture devices are usually implemented as CoreMediaIO plug-ins that are loaded at app launch and therefore affected by this.
For a quick test, you could try to disable the Hardened Runtime or set an entitlement that disables library validation with the HR turned on. I don't know if apps with this entitlement are accepted in the Mac App Store though.
Another approach would be to re-sign the CoreMediaIO plug-in with your signing credentials (if that's possible/allowed): https://developer.apple.com/forums/thread/126895?answerId=398061022#398061022
The developers of Camo have a good FAQ with some technical details about the library validation implications on CoreMediaIO plug-ins and there's also a comprehensive StackOverflow answer here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With