w3c / csswg-drafts

CSS Working Group Editor Drafts
https://drafts.csswg.org/
Other
4.52k stars 672 forks source link

[mediaqueries] `streaming` media feature for implementing streamer mode #10973

Open nickserv opened 1 month ago

nickserv commented 1 month ago

I'm proposing streaming as a discrete media feature with active and none, used when streaming software is running or not running (respectively). This could be used to implement a streamer mode feature to Discord's, which automatically hides sensitive information when streaming software is running. This is necessary because software often exposes personal info that can be used for doxing or hacking.

nickserv commented 1 month ago

Example using streaming to toggle displaying the user's phone number on stream:

@media (streaming: active) {
  .phone {
    display: none;
  }
}

@media (streaming: none) {
  .phone {
    display: block;
  }
}
document.querySelector(".phone").style.display = window.matchMedia(
  "(streaming: active)",
).matches
  ? "none"
  : "block";
KennethHoff commented 1 month ago

I like the concept, but I don't like the name. It makes it sound like it has something to do with network streams. It also excludes a lot of other use cases, like a simple video recording or say a presentation.

Speaking of presentation; how about using that as the name?

@media (presentation: active) { }

@media (presenting: yes) { }
KennethHoff commented 1 month ago

Maybe it should be even more generic actually; say a prefers-* media query

nickserv commented 1 month ago

Maybe it should be even more generic actually; say a prefers-* media query

There could be something like prefers-privacy, but I feel you should be able to toggle this automatically:

@media (prefers-privacy: auto) { }
nickserv commented 1 month ago

I like the concept, but I don't like the name. It makes it sound like it has something to do with network streams. It also excludes a lot of other use cases, like a simple video recording or say a presentation.

Speaking of presentation; how about using that as the name?

I don't think streaming and presenting are the same use case though. For example if I'm presenting at an internal company meeting and our address shows up it's not a big deal, but I wouldn't want to leak my address if I were streaming at home.

I was trying to make the name consistent with scripting, but maybe streamer-mode would be more obvious, as it seems to the the de facto standard used by existing implements in native apps.

tabatkins commented 1 month ago

This sounds like a reasonable idea, tho I also don't like the name. ^_^ Do you know how Discord detects when you're streaming? It's not something that the OS itself communicates, right?

nickserv commented 1 month ago

This sounds like a reasonable idea

Thanks! I'm implementing a proprietary version currently, but I feel like this would be way more useful as part of the web platform.

tho I also don't like the name. ^_^

What do you think about the names in my previous two comments (prefers-privacy and streamer-mode)?

Do you know how Discord detects when you're streaming? It's not something that the OS itself communicates, right?

Based on my testing, Discord seems to use system APIs to determine if streaming apps are running (but it doesn't care if they're actually streaming or recording). Discord only documents support for OBS and XSplit, however I noticed Streamlabs Desktop works, so it's likely either looking for apps based on OBS or using a custom allowlist that actually includes more than those two apps. As far as I'm aware, there is no system API, apps are probably just looking at open processes or windows.

nickserv commented 1 month ago

@tabatkins Hey, friendly reminder, could you please reply? I'd like to unblock this.