Created
November 3, 2017 03:43
-
-
Save banjun/aacbc0ccd7a5f7da65d58806201d3eb8 to your computer and use it in GitHub Desktop.
list AVCaptureDevice including iOSScreenCaptureAssistant
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Cocoa | |
import CoreMediaIO | |
import AVFoundation | |
class ViewController: NSViewController { | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
var prop = CMIOObjectPropertyAddress( | |
mSelector: CMIOObjectPropertySelector(kCMIOHardwarePropertyAllowScreenCaptureDevices), | |
mScope: CMIOObjectPropertyScope(kCMIOObjectPropertyScopeGlobal), | |
mElement: CMIOObjectPropertyElement(kCMIOObjectPropertyElementMaster)) | |
var allow: UInt32 = 1; | |
CMIOObjectSetPropertyData(CMIOObjectID(kCMIOObjectSystemObject), &prop, | |
0, nil, | |
UInt32(MemoryLayout.size(ofValue: allow)), &allow) | |
let devices = AVCaptureDevice.devices() | |
NSLog("%@", "devices = \(devices)") | |
} | |
} |
Author
banjun
commented
Nov 3, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment