iOS 11 Prevent Screen Record like Netflix

后端 未结 4 1031
旧巷少年郎
旧巷少年郎 2021-02-09 02:30

I have video playing in my application which I don\'t want to be recorded. What Netflix application do is that they let the audio capture but not the video whi

4条回答
  •  情书的邮戳
    2021-02-09 03:13

    You can listen for a UIScreenCapturedDidChange notification.

    NotificationCenter.default.addObserver(self, selector: #selector(screenCaptureChanged), name: NSNotification.Name.UIScreenCapturedDidChange, object: nil)
    

    This is called when iOS 11 screen recording begins and ends. When the user is recording the screen, you can modify the UI to block any content that you don't want recorded.

    This notification is fired when UIScreen's isCaptured property changes. You can also inspect this property yourself:

    UIScreen.main.isCaptured
    

提交回复
热议问题