从 OS X 应用程序录制 iPhone/iPad 屏幕,就像 QuickTime Player

Record iPhone/iPad screen from a OS X App just like QuickTime Player

我知道可以使用 QuickTime 播放器录制 iOS 屏幕。 (iOS 设备显示为相机)

我可以使用 AVFoundation 为 Mac OS X 录制 iOS 屏幕吗?

我想创建一个可以记录 iOS 设备屏幕的 OS X 应用程序。

归功于 NadavRub

引自 the PDF transcript for WWDC 2014 session #508 “Camera Capture: Manual Controls” 的第 28 页:

iOS devices are presented as CoreMedia IO “DAL” plug-ins

You must opt in to see iOS screen devices in your OS X app

CMIOObjectPropertyAddress prop =
                           { kCMIOHardwarePropertyAllowScreenCaptureDevices,
                             kCMIOObjectPropertyScopeGlobal,
                             kCMIOObjectPropertyElementMaster };
UInt32 allow = 1;
CMIOObjectSetPropertyData( kCMIOObjectSystemObject,
                           &prop, 0, NULL,
                           sizeof(allow), &allow );

此外,请参阅 my blog CoreMediaIO 捕获示例以直接拦截从设备发出的原始压缩负载