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 while screen is being recorded.
Anyone have idea how to implement this feature?
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 while screen is being recorded.
Anyone have idea how to implement this feature?
You can listen for a
UIScreenCapturedDidChange
notification.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
'sisCaptured
property changes. You can also inspect this property yourself:Netflix solution is NOT about the code. It is called DRM or Digital Rights Management. It protects the data from any piracy. Including screen records/shots and downloading. Man, it's expensive.
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
:}
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.