iOS 11 Prevent Screen Record like Netflix

后端 未结 4 1414
失恋的感觉
失恋的感觉 2021-02-09 02:26

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 02:58

    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
    

提交回复
热议问题