IOS detects / blocks screen recording with QuickTime player

I want to block screen recording or video output in my application using QuickTime Player.

I discovered the hdmi output and transmitted using UIScreen

. But the QuickTime Player video was not found.

How do I detect QuickTime Player?

Thank.

0


source to share


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


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







All Articles