Detect if game is being streamed or recorded

Is there any way to detect if the game if being recorded or streamed? I had a thought of putting some cryptids in my game, and giving them a higher chance of showing if the games being steamed/recorded.

Not really. You could check a list of running processes and maybe see OBS or another streaming application, but you wouldn’t know if it was recording you or anything at all. Depending on the privilege level your application is running at you might see nothing at all.

3 Likes

That may be good enough. If they have OBS running and the game its presumed that they are recording the game.

I’m curious what the standard privilege level is for games on most computers. Would checking if a program is running trigger a permission request? If so that kind of defeats the purpose and cause unnecessary confusion.

Is it possible to detect if they are streaming something from twitter?

As a solution given by @IInspectable on stack overflow , here is a basic C# to detect if any unity built application is being screen recorded. It blacks out the screen when it’s recorded. While this is not the best security solution we can implement but it’s good enough for applications and games.

The supported way to prevent window contents to show up in a screen capture is to mark the respective window so that the OS can blank it out.
This is done using the SetWindowDisplayAffinity API call, introduced in Windows 7. Passing the WDA_MONITOR flag will allow the window to display on a monitor. The window will appear with no content everywhere else (such as when capturing the screen).
Take note that SetWindowDisplayAffinity can only be used on top-level windows. There is no public API to selectively apply the same behavior to child windows (such as an EDIT control).

using System;
using System.Runtime.InteropServices;
using UnityEngine;

public class ScreenCaptureProtection : MonoBehaviour
{
    private const int WDA_NONE = 0x00000000;
    private const int WDA_MONITOR = 0x00000001;

    [DllImport("user32.dll")]
    private static extern bool SetWindowDisplayAffinity(IntPtr hwnd, uint dwAffinity);

    [DllImport("user32.dll")]
    private static extern IntPtr GetActiveWindow();

    void Start()
    {
        SetWindowAffinity();
    }

    void SetWindowAffinity()
    {
        IntPtr hwnd = GetActiveWindow();
        if (hwnd != IntPtr.Zero)
        {
            bool result = SetWindowDisplayAffinity(hwnd, WDA_MONITOR);
            if (!result)
            {
                Debug.LogError("Failed to set window display affinity.");
            }
            else
            {
                Debug.Log("Window display affinity set successfully.");
            }
        }
        else
        {
            Debug.LogError("Failed to get active window handle.");
        }
    }
}

Create a separate game object in the scene and attach this script to it. Please note you will not see any changes in the unity editor itself.
You can also check this documentation out :
[SetWindowDisplayAffinity function (winuser.h) - Win32 apps | Microsoft Learn](http://SetWindowDisplayAffinity function (winuser.h))

It seems that the point here is to make game unable to be recorded. The example in short says that you should hide the window if something else happens (that im unsure what). However if players select another window as top-level one, hide the game window, the monitor will work normal, right? Bypassed the security (players will be able to screenshot a piece of game in theory).

I assume you’re making big complexity security stuff, otherwise there is no need to do all of that, as you would even like to get players recording your game and increasing the popularity of it.

Physically impossible. The game is running on hardware you do not have physical control over. Easiest way to get around such a misguided attempt at banning streaming would be to run their HDMI cord right over to any of a hundred different HDMI recording devices, or any of a dozen HDMI live-streaming devices.

Also, @Chinmay_hs14 there is a rule against necro-posting. This was a dead thread over three years ago.

3 Likes

But do we need to mess with the player’s hardware to ban recording? by the example i thought for record something windows would activate a “recording mode” or something like. Im studying system development stuff but i still rubbish on it. However you would need big knowledge of C# for do something like this, much more than the average or even the needed.

Sorry i didnt saw the dates i thought it would get active ;-;

No, the thread was actually about to award players when they stream. Only the last necro post somehow is talking about preventing streaming which is completely off topic. Though apart from that you can NEVER prevent streaming because many professional streamers have a 2 PC setup and actually route the HDMI output of their gaming PC through an external recording device and the streaming happens on the second PC. This is completely undetectable on the gaming PC. A similar thing is true for virtual machines. Though there’s actually a chance to tell that you run in a VM, but it depends on the VM.

1 Like

Now that you said, indeed the thread isnt based on security and block recording, is for reward recorders…

I already found games that reward yt players. However those games dont know when player record, just notice them after they record and feature them once they get popular. This seems more reasonable and easier, you just need to figure how to give privilege to certain players instead of all

Oh im getting confused this is the perfect moment for a unity mod close this necroed thread…

1 Like

You can read the EDID data from the HDMI port and check against a list of known manufacturers. It won’t work for everything though because some devices like Elgato’s have the option to override the EDID data feeding false info back to the HDMI port.

That is true, however chances that you get false positives would get high and as a result the game could not be played at all. Apart from that there are EDID emulators out there that you can simply plug in between. They are quite common when you have HDMI switches as the device identification often creates problems. Though many capture cards support uploading a custom EDID file as automatic negotiation is not always what you want :slight_smile:

If roger0 want to give privileges for players that record the game, for me seems reasonable to feature popular players after they record, and give some type of mod that allows players featured to have some special stuff, as most games are doing today (e.g., arras.io give some cool power to some featured players, they can spawn cool stuff and do more things that average players dont). Managing the list of current processes doing something can cause the code to make small confusions. The code can give privileges if it thinks the player is recording, even if it doesnt do really. And while OBS is almost a standard for recording screen, there are other tools. Making the code able to detect all of these tools is unnecesary pain. About pain, i really lost track about how to make code manage HDMI stuff. HDMI seems to be a cable that transmits something from point A to point B, and usually you dont have control in this kind of systems.

If roger0 wants to ban recording for some reason, then try to get what is happening from the compiter of players for manage certain conditions. If you want a fort knox, you must need op coding skills. But seems easier to just give some waarning to players, perhaps a strike or a ban, if players start to do what you dont want them to. If a rich pro player have two computers and puts the record in other computer with a HDMI cable, you could try to put something in their HDMI for block recording in the other computer. However this is a bit hacking.

Making a broad statement here from both security and privacy aspects.

Avoid practices such as this, No , a game should not aggregate a list of other processes running, it has no business to, I don’t care what noble goals you may have, I do wish windows had a better privilege system or more restrictive UAC control that would warn you if an attempt to query list of running processes (Should be on admin level).

“Oh look, found a process of a crypto wallet running, user is probably into crypto and has money”
See how dangerous it is?

3 Likes

You left out the best part. :stuck_out_tongue:

As you may think its a joke, search for “assassin’s creed mirage black friday ad” ingame ad.

it was already done.

I don’t actually. I don’t really care that much about the ad itself. It’s the selling of customer data that concerns me and it absolutely is a thing that will happen so the less a game is able to access anything that I don’t directly feed it the happier I am.

2 Likes

Then look for unity ironsource, you are gonna have a blast.

If you are looking for an engine that respects your privacy and data.
Let’s give the moderators a reason to ban me and delete this message, Well, this is the shіttiest engine you could use.

on the other hand, unreal comes with a rootkit (named easy anti cheat), so choose your poison.

You have to explicitly set up EAC. It’s not enabled or even functional when enabled by default. I’m honestly not that concerned with EAC because I know more or less how and what it’s doing under the hood. I’m not happy with it but I know why it exists and I can live with it.

https://dev.epicgames.com/docs/game-services/anti-cheat/using-anti-cheat

AFAIK you can disable everything for Unity.