I create a black view and add it at the top of the UIWindow. Then, in the field of view of the PlayerVideo controller, create an 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 blocks PlayerVideo during user recording. However, I would like to create something like Netflix. I want users to do whatever they want while watching a movie. If they record, they can continue to watch the video without black viewing. However, when they stop recording, the video will be saved with a black look. I still understand how Netflix really liked it.
source share