IOS detects / blocks screen recording with QuickTime player
2 answers
So you don't know how to record a recording in QuickTime Player.
But I found a solution with some trick.
When recording in QuickTime Player, the AVAudioSession output port has been changed to HDMIOutput.
So I am coding like this ... (Swift 2.2)
func checkOutputPortType() {
let asRoute = AVAudioSession.sharedInstance().currentRoute
for output in asRoute.outputs {
if output.portType == AVAudioSessionPortHDMI {
// something you want..
}
}
}
Insert this function into ViewDidLoad and add notification AVAudioSessionRouteChangeNotification
.
NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(checkOutputPortType), name: AVAudioSessionRouteChangeNotification, object: nil)
Thank.
+3
source to share
With iOS 11, you can use notification
NSNotification.Name.UIScreenCapturedDidChange
on AppDelegate.swift
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
NotificationCenter.default.addObserver(self, selector: #selector(checkIFScreenIsCapture), name: NSNotification.Name.UIScreenCapturedDidChange, object: nil) ......
use selector
func checkIFScreenIsCapture(notification:Notification){
guard let screen = notification.object as? UIScreen else { return }
if screen.isCaptured == true {
}else{
}
}
+1
source to share