mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-14 14:43:16 -06:00
6176c0a79d
* feat(macos): add native camera PTZ controls Add physical UVC pan, tilt, and zoom through the signed Mac app, with camera.ptz.control kept behind dangerous-command approval. Verified against real Insta360 Link 2 Pro hardware. * refactor(agents): split message tool display config * fix(mac): harden camera PTZ contracts
29 lines
889 B
Swift
29 lines
889 B
Swift
import AVFoundation
|
|
|
|
enum CameraDeviceResolver {
|
|
static func availableCameras() -> [AVCaptureDevice] {
|
|
var types: [AVCaptureDevice.DeviceType] = [
|
|
.builtInWideAngleCamera,
|
|
.continuityCamera,
|
|
]
|
|
if let external = self.externalDeviceType() {
|
|
types.append(external)
|
|
}
|
|
return AVCaptureDevice.DiscoverySession(
|
|
deviceTypes: types,
|
|
mediaType: .video,
|
|
position: .unspecified).devices
|
|
}
|
|
|
|
static func camera(deviceId: String) -> AVCaptureDevice? {
|
|
self.availableCameras().first { $0.uniqueID == deviceId }
|
|
}
|
|
|
|
private static func externalDeviceType() -> AVCaptureDevice.DeviceType? {
|
|
if #available(macOS 14.0, *) {
|
|
return .external
|
|
}
|
|
return AVCaptureDevice.DeviceType(rawValue: "AVCaptureDeviceTypeExternalUnknown")
|
|
}
|
|
}
|