jellyfin / jellyfin-web

Web Client for Jellyfin
https://jellyfin.org
GNU General Public License v2.0
2.28k stars 1.22k forks source link

Gamepad support broken on Steam Deck #4296

Open KingIzzymon opened 1 year ago

KingIzzymon commented 1 year ago

Describe The Bug No gamepad support when accessing Jellyfin web client via Google Chrome flatpak on Steamdeck using Steam's gamepad template. while in Steam Deck Game Mode

Steps To Reproduce

  1. Turn on steam deck and load into game mode
  2. Open google chrome from steam using the "Gamepad" steam controller template
  3. Access the Jellyfin web client
  4. Ensure "Gamepad support" is enabled by clicking on your profile (upper right) -> Controller options -> enable gamepad support then reload the web page

Expected Behavior The steamdeck controls should be able to navigate the Jellyfin web client, accessing media libraries, selecting content and controlling the web media player.

Logs No errors

Screenshots Not screenshotable

System (please complete the following information):

dmitrylyzo commented 1 year ago

Try changing the Display mode (in User settings / Display) to TV and refresh browser.

KingIzzymon commented 1 year ago

Ah, that did the trick! Would you mind if I made a PR to add a note next to the "Enable gamepad" setting to say that display needs to be in TV mode?

There are several people who have posted about this confusion on various websites.

dmitrylyzo commented 1 year ago

We need to (try to) detect Steam Deck (browser.js) and treat it as a TV (probably as not "slow") to automatically change the display mode.

We can also automatically activate a gamepad for it, as this is its main control. :thinking:

A note about the TV mode is welcome.

KingIzzymon commented 1 year ago

Sounds like a plan. I'll submit a quick PR this afternoon to add the label then I'll take a peek at trying to detect the steam deck.

KingIzzymon commented 1 year ago

So javascript's "navigator.userAgent" function is only able to read that I'm using a linux operating system:

navigator.userAgent => User-agent header: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) CHrome/109.0.0.0 Safari/537.36

Because the steam deck is just a handheld linux computer, I'm not sure theres anything we can do to autodetect the steam deck at this time like we do for the xbox and ps4.

nyanmisaka commented 1 year ago

You can use WebGL to check the GPU code name "VanGogh", which is reported by Mesa radeonsi.

But this is not robust because the user may not have Mesa installed or using the lavapipe software renderer. And future steam decks may use different GPUs.

KingIzzymon commented 1 year ago

@nyanmisaka it's an option but I didn't think a not-so-futureproof method would be a good idea :/

AidanDaniel97 commented 1 year ago

Hey - I don't have a steam deck but curious what the solution may be for this! These might not be relevant but off the top of my head there's some other ways we might be able to detect a steam deck:

Perhaps combining these and previous options can determine if a device is a steam deck, although without a definitive user agent or GPU information that wont change these methods may not be very robust as mentioned previously.

dmitrylyzo commented 1 year ago
  • Are there any unique properties for the gamepad if you use the Gamepad API?

Brilliant idea :+1: There is https://developer.mozilla.org/en-US/docs/Web/API/Gamepad/id When I tested gamepad navigation on PC, it gave something meaningful like "Xbox 360 Controller", iirc.

jellyfin-bot commented 1 year ago

This issue has gone 120 days without comment. To avoid abandoned issues, it will be closed in 21 days if there are no new comments.

If you're the original submitter of this issue, please comment confirming if this issue still affects you in the latest release or master branch, or close the issue if it has been fixed. If you're another user also affected by this bug, please comment confirming so. Either action will remove the stale label.

This bot exists to prevent issues from becoming stale and forgotten. Jellyfin is always moving forward, and bugs are often fixed as side effects of other changes. We therefore ask that bug report authors remain vigilant about their issues to ensure they are closed if fixed, or re-confirmed - perhaps with fresh logs or reproduction examples - regularly. If you have any questions you can reach us on Matrix or Social Media.

chriscavalluzzi commented 11 months ago

Hi friends!

I found the Gamepad ID of a Steam Deck: Microsoft X-Box 360 pad 1 (STANDARD GAMEPAD Vendor: 28de Product: 11ff). This was pulled using navigator.getGamepads();, screenshot below. I have only one Steam Deck, so I can't confirm if this ID is universal, nor do I know if it is unique to Steam Decks. Also, this ID was retrieved on Chromium, and the description of the ID field implies that the ID can be formatted very differently in different browsers (and would definitely be different in Firefox).

image

I attempted to query this on the Google Chrome and Firefox flatpaks as well, but both of them always returned an array of 4 null gamepads (see below). I tried in both Desktop Mode and Game Mode, and I also made sure to press buttons on the Steam Deck's built-in controls before running the command, because of the API's fingerprinting prevention. This also happened when I plugged in an external gamepad as well, which makes me think there might be some sort of compatibility issue with the Gamepad API on these browsers, but maybe I'm completely off-base. Apologies if I'm out of my depth here, I'm new to the project and the Gamepad API.

image

arucard21 commented 8 months ago

I did a quick search based on what @chriscavalluzzi found and it seems like the vendor code (28DE) in the gamepad id refers to Valve specifically. I found this on a USB device listing website: https://devicehunt.com/view/type/usb/vendor/28DE

So this should reliably identify any Valve controllers. That same product code (11FF1) was not listed on that website but it most likely refers specifically to the controller on the Steam Deck. A similar product code seems available for other Valve hardware, like the Steam controller or VR controller. So it does not seem like a unique code per individual device.

Foxhoundn commented 7 months ago

Hi friends!

I found the Gamepad ID of a Steam Deck: Microsoft X-Box 360 pad 1 (STANDARD GAMEPAD Vendor: 28de Product: 11ff). This was pulled using navigator.getGamepads();, screenshot below. I have only one Steam Deck, so I can't confirm if this ID is universal, nor do I know if it is unique to Steam Decks. Also, this ID was retrieved on Chromium, and the description of the ID field implies that the ID can be formatted very differently in different browsers (and would definitely be different in Firefox).

image

I attempted to query this on the Google Chrome and Firefox flatpaks as well, but both of them always returned an array of 4 null gamepads (see below). I tried in both Desktop Mode and Game Mode, and I also made sure to press buttons on the Steam Deck's built-in controls before running the command, because of the API's fingerprinting prevention. This also happened when I plugged in an external gamepad as well, which makes me think there might be some sort of compatibility issue with the Gamepad API on these browsers, but maybe I'm completely off-base. Apologies if I'm out of my depth here, I'm new to the project and the Gamepad API.

image

Hey - can you tell me how did you manage to get anything else then the 4x null array? I tried Chrome and Chromium and both have the same result. It seems to be impossible to get Steam Deck recognized in browsers right now which is a bummer :/