我想使用QuickTime Player阻止每个应用的屏幕录制或视频输出。使用QuickTime播放器的iOS检测/屏蔽屏幕录制
我用UIScreen
检测到hdmi输出和airplay。 但QuickTime Player的视频录制没有检测到。
如何检测QuickTime Player?
谢谢。
我想使用QuickTime Player阻止每个应用的屏幕录制或视频输出。使用QuickTime播放器的iOS检测/屏蔽屏幕录制
我用UIScreen
检测到hdmi输出和airplay。 但QuickTime Player的视频录制没有检测到。
如何检测QuickTime Player?
谢谢。
因此不知道检测QuickTime Player的录音。
但我找到了一些解决方案。
如果QuickTime Player录音正在运行,AVAudioSession的输出portType已更改为HDMIOutput。
所以我编码如下...(雨燕2.2)
func checkOutputPortType() {
let asRoute = AVAudioSession.sharedInstance().currentRoute
for output in asRoute.outputs {
if output.portType == AVAudioSessionPortHDMI {
// something you want..
}
}
}
插入,在viewDidLoad中发挥作用,并添加AVAudioSessionRouteChangeNotification
通知。
NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(checkOutputPortType), name: AVAudioSessionRouteChangeNotification, object: nil)
谢谢。
与iOS 11,你可以使用通知
NSNotification.Name.UIScreenCapturedDidChange
上AppDelegate.swift
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
NotificationCenter.default.addObserver(self, selector: #selector(checkIFScreenIsCapture), name: NSNotification.Name.UIScreenCapturedDidChange, object: nil) ......
使用选择
func checkIFScreenIsCapture(notification:Notification){
guard let screen = notification.object as? UIScreen else { return }
if screen.isCaptured == true {
}else{
}
}