AVFoundation macOS app use iPhone camera

I am trying to build a small macOS app that can use the camera on my iOS device, mainly as video monitoring app respecting iPhone orientaion (landscape and portrait) eventually would be good to be able trigger record function on the iOS device but this is not essential, main aim is to be able to have live feed from iOS camera on macOS.


I have a little swift xcode macOS app that currently works with the facetime camera on Mac but with iPhone is plugged in I do not see any additional devices avalible via.


> let listdevices:Array = (AVCaptureDevice.devices())


I am a little stuck. Any help appriciated. assuming I need to do something with IOKit or Camera Connection Kit ?


Or should I look at airplay mirroring macOS app instead ?


All my code is online here https://gitlab.adamprocter.co.uk/adamprocter/DeviceMonitor/tree/master


Thank you

Using an iOS device's camera as an AVCaptureDevice on macOS is not a supported feature. You may use your iOS device's screen as a recording device, enabling you to do screen grabs on the mac of whatever is taking place on the iOS device's screen. In order to do that, you must opt in first using CoreMediaIO's kCMIOHardwarePropertyAllowScreenCaptureDevices system-level property. Of course, if an app that uses the camera happens to be the foreground app, and it is displaying a preview of the camera on the iOS screen, you can capture these contents to the mac (with whatever UI the app displays).


If you want to capture frames from an iOS camera and preview them on a mac, you'll need to beam them over yourself, compressing them on the sending side and decompressing them on the receiving side, unless you've got an extremely fast connection between the iOS device and the mac.

AVFoundation macOS app use iPhone camera
 
 
Q