How to prevent screen capture

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By manglemix

If I want to create a game that prevents users from screen recording with authorization, how would I do that? This should work similarly to how Netflix prevents screen captures; Whenever you try to take a screenshot, the resulting image is black

EDIT: I am now aware that you can do this on android, but my target platform are desktops

According to https://stackoverflow.com/questions/28606689/how-to-prevent-screen-capture-in-android, it’s done through a flag called FLAG_SECURE.

Perhaps there is some way to tell Godot to add flags to the window produced when exporting to Android?

Aimarekin | 2022-03-13 22:36

I’m not sure if this might be a device diference, but when I take a screenshot of, for example, a Chrome incognito tab, my device shows “This app does not allow to take screenshots” and does not take a picture, instead of producing a black image as you described.

I know this can be set during runtime, because you’re allowed to take pictures of normal tabs and you can also tweak the app’s settings to allow you to take screenshots in incognito.

Aimarekin | 2022-03-13 22:36

This is interesting. unfortunately I am not coding for android though

manglemix | 2022-03-13 22:37

:bust_in_silhouette: Reply From: CassanovaWong

Not sure, but if I were attempting this, I’d probably experiment with the Operating System Functions, like OS.kill() or something…

" Error kill ( int pid )

Kill (terminate) the process identified by the given process ID (pid), e.g. the one returned by execute in non-blocking mode.

Note: This method can also be used to kill processes that were not spawned by the game.

Note: This method is implemented on Android, iOS, Linux, macOS and Windows.