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
I create a black view and add it at the top of UIWindow. Then, in view controller of PlayerVideo, create the observer
NotificationCenter.default.addObserver(self, selector: #selector(screenCaptureChanged), name: NSNotification.Name.UIScreenCapturedDidChange, object: nil)
Then, in screenCaptureChanged
:
(void) screenCaptureChanged {
if (@available(iOS 11.0, *)) {
BOOL isCaptured = [[UIScreen mainScreen] isCaptured];
if (isCaptured) {
self.blackView.hidden = false;
}
else {
self.blackView.hidden = true;
}
}
}
This solution will block the PlayerVideo when user is recording. However, I would like to create something like Netflix did. I want to let users do whatever they want while watching movie. If they are recording, they can continue watching video without black view. However, when they stop recording, the video will be save with black view. I'm still figuring out how Netflix did like this.