How to determine if a player is carrying headphones
- Edited
JiuMengD
you're looking for something more along the lines of get_output_port_list()
. it doesn't exist.
if you're trying to route audio to the headphone port rather than the speakers, the operating system is supposed to take care of that.
if it doesn't, i advice you stop downloading strange files. or switch to a more stable linux distro.
Edit: if a forum of people are telling you your design decision is creepy, its worth reconsidering.
- Edited
There might be something for each OS that could perhaps be polled via the OS class, but each OS likely has it's relevant executable or API to run for determining this. It might be worth opening an issue on the proposals repo for a feature request tho.
I don't see this as any more of a privacy violation than checking for input devices like gamepads tho. Seems like a valid enough feature request.
As for getting input from a mic or webcam or such where there'd be a genuine security and privacy concern, that's a whole other matter and the security layer for such is up to the OS. On linux sessions running wayland user would likely get a password prompt to give permission for the relevant portal to be run by a specific application.
- Edited
Note I said (and bolded) "wear", not "device connected". The latter is only creepy, well, depending on the actual intent.
- Edited
For all intents and purposes when headphones are plugged in, if the user wants to actually hear something they also likely will wear the headphones, so in terms of inference... same difference?
Megalomaniak My wife would beg to differ. She plays games with headphones plugged but lying on the table. Obviously, you can't infer with certainty if the headphones are on the head by looking at the plugged status. You need more information... that can only be gained via more privacy intrusion, i.e. by looking at the user through some camera
But I guess the OP just meant how to determine plugged status.
- Best Answerset by JiuMengD
Thank you for your answers. In the end, I have decided to let the players set up whether they have headphones in the game themselves. This approach is better for player privacy and can also solve my problem
- Edited
JiuMengD In the end, I have decided to let the players set up whether they have headphones in the game themselves.
Yeah, that's the best option. I have my speakers connected through an amplifier that I can connect headphones to. When I plug them in, the speakers themselves are turned off. So there's no way to tell what I'm listening to through the hardware at the moment.
i dont even get why there is distinction for some applications/games - headphones or speakers. Its just audio. Why thy dont ask if you have monitor or tv then? Same principles?
Im talking off topic but this seems like its stupid atleast for me.
I get that the headphones have only stereo stuff and speakers can be arranged up to or more than 7.1 but still its just an audio..
- Edited
kuligs2 The headphone option is particularly relevant to the headphones that are lacking amplification.
edit: worth reading comments here