How to disable screen recording?

How can i disable screen recording for my application.
i checked posts here but no one solved this issue or discover the solution.

Help please

Have you done some research if this is even possible in an native application?

1 Like

While you’re thinking about this, consider how you’re going to handle the possibility of users pointing a camera at the screen.

Yeah and i didn’t find any solution in native :frowning_face:

My guess, you would need to jailbreak the device and mod the OS. And then build a capacitor/cordova plugin to trigger on/off API you patched into the OS.

Just trying to give a solution here…

1 Like

Yes – it is possible. But you have to create your own Cordova or Capacitor Plugin :frowning:

How does it work?
In Swift you can create observers. These observers can observe screenshots or screen recordings too:

UIScreen.main.addObserver(self, forKeyPath: "captured", options: .new, context: nil)

Your plugin should now watch and receive this changes (is user is recording):

override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey: Any]?, context: UnsafeMutableRawPointer?) {
    if (keyPath == "captured") {
        let isCaptured = UIScreen.main.isCaptured

        print(isCaptured)
    }
}

If the user is recording the Screen, the plugin could send a response to the App, and you could display a blank screen (for example a simple div with position fixed :+1:

Do you really need it?
Why do you want to prevent users from recording the screen? This is not very good for the User Experience.

It can take a few hours/days to create such a plugin, but (AFAIK) it is the only way to prevent users from recording the screen.

1 Like

Wemaking an education app for client. he want to prevent any one from recording the courses videos

The only way I can think of to achieve this is to not distribute these videos, then.

I already mentioned one very simple recording strategy that will bypass anything you try to do in software: pointing a camera at the screen. Another would be to simply run the app in an emulator and do the screen capture on the host machine.