How do I set up a mirroring session between iOS 8 and Yosemite?

有些话、适合烂在心里 提交于 2019-12-17 19:27:28

问题


On OS X Yosemite, the screen of an iOS 8 device can be mirrored to the OS X machine and saved as a media file. This can be done manually using QuickTime Player, but I want to do the same programatically.

Reading the docs, the iOS 8 device should be exposed as a webcam.

Calling [AVCaptureDevice devicesWithMediaType:AVMediaTypeVideo] on my Mac returns an NSArray with no elements.

How can I setup a mirroring session using iOS 8 and Yosemite? How can I detect the capture device for the mirroring session?


回答1:


Quoting from p28 of the PDF transcript for WWDC 2014 session #508 “Camera Capture: Manual Controls”:

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 );

Also, see my blog for CoreMediaIO capture sample to directly intercept the raw compressed payload sent out from the device



来源:https://stackoverflow.com/questions/26136429/how-do-i-set-up-a-mirroring-session-between-ios-8-and-yosemite

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!