可以在Quicktime中使用新电影录制>相机下拉>选择iOS设备。 AppShow和Screenflow都这样做。
我试过这个
AppleScript的
tell application "QuickTime Player"
set myrec to new movie recording
tell myrec
set current camera to video recording device named "Morten's iPod touch"
end tell
end tell
但是这给了我
错误" QuickTime播放器出错:无法设置视频录制设备\#34; Morten的iPod touch \"文件\"电影录制\"视频录制设备命名为“莫特的iPod touch \”#34;文件\"电影录制\"。"视频录制设备编号-10006" Morten的iPod touch"文件"电影录制"
AVFoundation 由于iOS设备在Quicktime中显示为相机,我认为它将是AVFoundation中的捕获设备,但此代码
for device in AVCaptureDevice.devices() {
println(device)
}
给我一个我的Facetime高清摄像头和一个麦克风。
答案 0 :(得分:11)
您必须选择在OS X应用中查看iOS屏幕设备。
请参阅" How do I set up a mirroring session between iOS 8 and Yosemite?"
CMIOObjectPropertyAddress prop = {
kCMIOHardwarePropertyAllowScreenCaptureDevices,
kCMIOObjectPropertyScopeGlobal,
kCMIOObjectPropertyElementMaster
};
UInt32 allow = 1;
CMIOObjectSetPropertyData(kCMIOObjectSystemObject, &prop, 0, NULL, sizeof(allow), &allow);
您可以使用以下方式获取设备列表:
NSArray *devices = [AVCaptureDevice devicesWithMediaType:AVMediaTypeMuxed];
答案 1 :(得分:2)
var property = CMIOObjectPropertyAddress(mSelector: CMIOObjectPropertySelector(kCMIOHardwarePropertyAllowScreenCaptureDevices), mScope: CMIOObjectPropertyScope(kCMIOObjectPropertyScopeGlobal), mElement: CMIOObjectPropertyElement(kCMIOObjectPropertyElementMaster))
var allow : UInt32 = 1
let sizeOfAllow = MemoryLayout<UInt32>.size
CMIOObjectSetPropertyData(CMIOObjectID(kCMIOObjectSystemObject), &property, 0, nil, UInt32(sizeOfAllow), &allow)