4

I am working on an Ionic Framework application, and we show critical information on some pages. We like to prevent the user from taking a screenshot on these pages. We are able to do this on the Android platform; however, on iOS devices, we are not able to do so since there is no public API provided by Apple as of today.

We found ScreenShieldKit, but their pricing is too expensive for the function that we will be needing from them. So we came to an idea that how the paid streaming services prevent their users from taking screenshots of their video, we think that overlaying a video element might trick the OS and give a blank screen shot of that portion by going through DRM.

I found out that Safari uses FairPlay, but the internet doesn't have that much implementation or guide on how to do this kind of application. Do you think this is feasible to what we are trying to achieve? Does the DRM work on non-streaming videos? Could you give steps on how to implement DRM EME?

Rich
  • 3,928
  • 4
  • 37
  • 66
  • I dont know how to answer your question, but you can't stop a user from taking pictures of something that is on their screen. Maybe you can stop them from screenshotting it, but they can still just take a picture of the physical screen. The idea seems silly to me. If you don't want your users to have some information you have to just not show it to them. If the information is very valuable to them and they want it, it is very likely they will just grab a camera and take a picture of their screen. – ICW Feb 24 '21 at 04:51
  • @IsaacCWay yes I know that we cannot let them take a picture from a real camera. But I am trying to achieve at least to limit the user to take screenshot of that page – Rich Feb 24 '21 at 04:57

1 Answers1

2

I’m sure you are aware that a developer can’t entirely prevent a user/app from taking screenshots. In iOS, there is no dedicated API to stop screenshots from being taken; in addition to that, you/developer/app do not have access to delete photos in the photo gallery of the user (which makes sense); so that is why it’s problematic when it comes to iOS compared to Android.

Below I’ll try to help you with some suggestions you might find helpful for you further investigations:

  • there is a way to detect that screenshot was taken using iOS API

For iOS 7+, you may write something like this:

NotificationCenter.default.addObserver(
    forName: UIApplication.userDidTakeScreenshotNotification,
    object: nil, queue: nil) { _ in
        //what to execute after screenshot?
} 

So maybe after one took a screenshot, your app could do, for example, warn, notify, show alerts to other users (if there are many), etc.

  • Also, you may visit this Cordova Plugin to see if it works:

In the README.md file on the GitHub page, it says that

This is a cordova plugin to enable/disable screenshots in android and ios

Finally, the way how ScreenShieldKit works is that it gives a developer a set of UI components (ImageView and Label) which are similar to UIKit ones. It's possible that image and text are rendered as a video protected by DRM, and that is why they are not visible in the screenshots.

Asol
  • 349
  • 3
  • 9
  • The `userDidTakeScreenshotNotification` only being triggered after the screenshot. We can *warn* or *notify* them, but it makes no sense since they have already taken a screenshot of it. The cordova plugin that you've mentioned is not working in iOS, I have already tried that before. For the `ScreenShieldKit`, that's what I am trying to achieve, but instead of having converted all the elements to video, I want to put a *video* element on top of my div where all the data is populated to *trick* the iOS to think that it is a video, yet it is a transparent one. – Rich Feb 25 '21 at 01:44
  • Though I am not familiar how to implement DRM for a video. – Rich Feb 25 '21 at 01:44
  • 1
    Hi Rich, I'm currently researching this as well, and am arriving at a similar strategy. I found this in a comment which seems possible: > Btw: From what I remember, as long as you use SAMPLE-AES method for HLS you will also get screenshot blocking. (Not guaranteed... But seems to be the actual behavior). – Anders Feb 29 '20 at 5:15 https://stackoverflow.com/questions/57940194/how-to-convert-image-to-video-with-drm-fairplay This sounds intriguing to me. See also: https://developer.apple.com/forums/thread/120552 – ukudala Feb 25 '21 at 22:41