Plex HTPC feedback

I am having an issue with inputmaps. It appears that my Xbox Elite 2 controller inputs are not detected, even though Plex HTPC detects the joystick. I took the following steps:

  • Navigate to C:\Users\MyUser\AppData\Local\Plex HTPC\inputmaps
  • Copy file .\examples\xbox-one.json to .\xbox-one.json
  • Edit the xbox-one.json file, replace "idmatcher": "Xbox One S Controller", with "idmatcher": "Xbox One Elite 2 Controller",

I have tried changing the name of the copied file be different from the example file. I have also tried changing the "name" JSON value not to match the example file.
I have also tried setting idmatcher to Xbox One.*, Xbox.*, .*, and even tried "XInput.*|Microsoft.*joystick driver" like in PlexMediaPlayer.

Plex HTPC clearly detects the controller as a joystick, but I cannot tell if it associates an inputmap config to it. At no point do I see expected input keycodes like "KEY_BUTTON_1" or "KEY_AXIS_0_DOWN" in the logs.

Here are my logs relating to Input:

Jan 05, 2022 19:36:09.764 [7176] DEBUG - [InputManager] Initializing.
Jan 05, 2022 19:36:09.765 [7176] INFO - [InputManager] Loading inputmaps from: C:/Program Files/Plex/Plex HTPC/inputmaps
Jan 05, 2022 19:36:09.771 [7176] INFO - [InputManager] Loading inputmaps from: C:/Users/MyUser/AppData/Local/Plex HTPC/inputmaps
Jan 05, 2022 19:36:09.818 [7176] INFO - [InputManager/Keyboard] Successfully inited input
Jan 05, 2022 19:36:09.818 [7176] DEBUG - [InputManager/QHotkey/QHotkeyInput] Initializing.
Jan 05, 2022 19:36:09.818 [7176] WARN - [InputManager/QHotkey/QHotkeyInput] Unable to map shortcut to native keys. Key: Qt::Key_MediaPause Modifiers: QFlags<Qt::KeyboardModifier>(NoModifier)
Jan 05, 2022 19:36:09.818 [7176] WARN - [InputManager/QHotkey/QHotkeyInput] Unable to map shortcut to native keys. Key: Qt::Key_MediaTogglePlayPause Modifiers: QFlags<Qt::KeyboardModifier>(NoModifier)
Jan 05, 2022 19:36:09.818 [7176] INFO - [InputManager/QHotkey] Successfully inited input
Jan 05, 2022 19:36:10.066 [11660] INFO - [Input/SDL] Found 1 joysticks
Jan 05, 2022 19:36:10.067 [11660] INFO - [Input/SDL] JoyStick #0 is Xbox One Elite 2 Controller with 16 buttons and 6 axes
Jan 05, 2022 19:36:10.067 [7176] INFO - [InputManager/SDL] Successfully inited input
Jan 05, 2022 19:36:10.068 [11660] INFO - [Input/SDL] Detected device was added.
Jan 05, 2022 19:36:10.068 [11660] INFO - [Input/SDL] Found 1 joysticks
Jan 05, 2022 19:36:10.068 [11660] INFO - [Input/SDL] JoyStick #0 is Xbox One Elite 2 Controller with 16 buttons and 6 axes
Jan 05, 2022 19:36:10.069 [10456] INFO - libCEC was successfully initialized, found version 262151
Jan 05, 2022 19:36:10.071 [7176] INFO - [InputManager/CEC] Successfully inited input
Jan 05, 2022 19:36:10.071 [7176] INFO - [DisplayManager] Found 3 Display(s).
Jan 05, 2022 19:36:10.071 [7176] INFO - [DisplayManager] Available modes for Display Name: NVIDIA GeForce RTX 3080 Ti

I also have an Xbox chatpad keyboard, to which Plex HTPC does indeed respond to keyboard events.

Jan 05, 2022 19:49:35.182 [16896] INFO - [Web] 00/03/2022 19:49:35:182 [*****:*****] DEBUG [ClickAbsorber]: Absorbed a click!
Jan 05, 2022 19:49:36.022 [16896] INFO - [Web] 00/03/2022 19:49:36:021 [*****:*****] DEBUG [ClickAbsorber]: Absorbed a click!
Jan 05, 2022 19:49:36.667 [16896] DEBUG - [InputManager] Input received: source: Keyboard keycode: M:3
Jan 05, 2022 19:49:36.667 [16896] DEBUG - [InputManager] Emit input action: ["M","menu"]
Jan 05, 2022 19:49:36.668 [16896] INFO - [InputManager] [InputConnector] Sending actions to UI: ["M","menu"]
Jan 05, 2022 19:49:36.683 [16896] DEBUG - [InputManager] Input received: source: Keyboard keycode: M:1

My temporary working solution is to use ReWASD to associate a profile with PlexHTPC.exe and remap my controller inputs to the keyboard, but this is brittle and cumbersome.

For what it’s worth, this same Xbox controller is detected by and works just fine with PlexMediaPlayer with the default example inputmap xbox-controller-windows.json. Here are some example logs:

2022-01-05 19:55:32 [ DEBUG ] InputComponent.cpp @ 160 - Input received: source: "Microsoft PC-joystick driver" keycode: "KEY_AXIS_0_DOWN" : InputBase::InputkeyState(KeyDown)
2022-01-05 19:55:32 [ DEBUG ] CachedRegexMatcher.cpp @ 68 - No match for: "KEY_AXIS_0_DOWN"
2022-01-05 19:55:32 [ DEBUG ] InputComponent.cpp @ 229 - Emit input action: ("right")
2022-01-05 19:55:32 [ DEBUG ] InputSDL.cpp @ 153 - JoyAxisMotion: 1 -649
2022-01-05 19:55:32 [ DEBUG ] InputSDL.cpp @ 153 - JoyAxisMotion: 0 22282
2022-01-05 19:55:32 [ DEBUG ] InputSDL.cpp @ 153 - JoyAxisMotion: 1 -2549
2022-01-05 19:55:32 [ DEBUG ] InputSDL.cpp @ 153 - JoyAxisMotion: 0 -25
2022-01-05 19:55:32 [ DEBUG ] InputSDL.cpp @ 153 - JoyAxisMotion: 1 -1767
2022-01-05 19:55:32 [ DEBUG ] InputComponent.cpp @ 160 - Input received: source: "Microsoft PC-joystick driver" keycode: "KEY_AXIS_0_DOWN" : InputBase::InputkeyState(KeyUp)
2022-01-05 19:55:32 [ DEBUG ] InputSDL.cpp @ 153 - JoyAxisMotion: 1 220
2022-01-05 19:55:33 [ DEBUG ] InputSDL.cpp @ 153 - JoyAxisMotion: 1 620
2022-01-05 19:55:33 [ DEBUG ] InputSDL.cpp @ 153 - JoyAxisMotion: 1 1049
2022-01-05 19:55:33 [ DEBUG ] InputSDL.cpp @ 153 - JoyAxisMotion: 1 1360
2022-01-05 19:55:33 [ DEBUG ] InputSDL.cpp @ 153 - JoyAxisMotion: 0 264
2022-01-05 19:55:33 [ DEBUG ] InputSDL.cpp @ 153 - JoyAxisMotion: 1 2937
2022-01-05 19:55:33 [ DEBUG ] InputSDL.cpp @ 153 - JoyAxisMotion: 0 3537
2022-01-05 19:55:33 [ DEBUG ] InputSDL.cpp @ 153 - JoyAxisMotion: 1 32576
2022-01-05 19:55:33 [ DEBUG ] InputComponent.cpp @ 160 - Input received: source: "Microsoft PC-joystick driver" keycode: "KEY_AXIS_1_DOWN" : InputBase::InputkeyState(KeyDown)
2022-01-05 19:55:33 [ DEBUG ] CachedRegexMatcher.cpp @ 68 - No match for: "KEY_AXIS_1_DOWN"
2022-01-05 19:55:33 [ DEBUG ] InputComponent.cpp @ 229 - Emit input action: ("down")

Would greatly appreciate any help with this. Otherwise Plex HTPC looks great!

You should note that only one small cause was fixed; the real fix is still pending.

I’ve changed it to add commas to many of the numbers in the overlay. Though the change is dependent on other changes being merged first so it may not be present in the next version.

All this did was set the video-sync option in MPV which you can do in the mpv.conf file. See the manual for the available options. Note: most likely the issue you are seeing will not be resolved by this but will be fixed with the layering changes I spoke of earlier.

I’ve made a change to make it have 0 brightness (it still retains the black color with a gradient on the alpha).

It logs the key presses it sees regardless of whether it is mapped to any actions. It appears that libSDL2 isn’t getting any input from your controller (it appears they have broken some things on Windows or MS did when building against newer APIs).

2 Likes

You many want to see if this controller issue is related to this bug detailed here.
Xbox Controller not working Plex HTPC
It would be nice to know the scope of affected gamepads.

Thanks, it does appear to be the same bug. The solution in the second post in that thread worked for me. Plex HTPC detects but cannot use my Xbox One Elite 2 controller when it is already connected to the PC prior to starting Plex HTPC. If I turn the controller off, start Plex HTPC, and then turn on the controller, it can deliver inputs.

Jan 11, 2022 10:51:22.068 [21196] DEBUG - [InputManager] Input received: source: Xbox One Elite 2 Controller keycode: KEY_AXIS_1_UP:0
Jan 11, 2022 10:51:22.068 [21196] DEBUG - [InputManager] Emit input action: ["up"]
Jan 11, 2022 10:51:22.068 [21196] INFO - [InputManager] [InputConnector] Sending actions to UI: ["up"]
Jan 11, 2022 10:51:22.220 [21196] DEBUG - [InputManager] Input received: source: Xbox One Elite 2 Controller keycode: KEY_AXIS_1_UP:1

Good to know. Several of us have been dealing with the same problem. Seems like an initialize issue. All we’ve been told is that they think it’s a dependency library issue, but afaik no one has taken a look at it for any possible fix or workaround. Or at least we haven’t heard of anyone looking at or working on the issue.

I am running Plex HTPC 1.9.0 and I have noticed a small bug regarding the Home view:
When a movie has been added in the library, it is visible in the “Movies” category under “Recently Added Movies” but not in the “Home” view, not unless I restart Plex HTPC.

Thanks for the update. It’s greatly appreciated. I hope we can get some state of an (official) player for linux soon, it’s sorely needed. (PMS is starting to show it’s age with it’s own plethora of issues).

So, it looks like Linux (specifically X11) is just not going to be capable of handling the layering that’s in development for Mac/Windows. An MPV developer summed it up pretty well in a GHI . I did attempt to make the compositor composite child windows within a parent window but it didn’t work at all. The furthest I got was being able to make sections of the parent window transparent and not composite child windows at all.

Does this mean you are hooking into X11 directly?? I really hope not, as there aren’t many apps today that use X11 and completely purging X11 from my system is such a close goal today. And with most distros shipping wayland by default nowadays, having a new app X11 only would not be a good time.

The only outstanding piece missing is LIRC support which is likely to require an update to snapcraft itself before we can use LIRC. The code works but the socket isn’t accessible inside the snap.

So, I haven’t really seen this mentioned anywhere else, and I know the release is just around the corner, but obviously you have opted for snap as a package format. Is this exclusive? Or will you officially provide other package formats?

I understand why people are opting for snaps, it seems like an easy solution, but as far as my experience (and opinion) it is the worst packaging format available for linux. And I for one will never install snapd on my system (as quite a lot of other people as well). So crossing my fingers for flatpak, appimage, deb, rpm (anything but snap really!)

Regardless, I want to show my appreciation towards treating linux users not as second-class citizens, but equal with other platforms (even though it has taken way too long). Thanks for all your work. Looking forwards to a release soon!

Any Idea of an ish ETA on Linux version?

This was more pointing out how X11 is entirely incapable of doing the layering of child windows properly and so it must stick to the old rendering mechanism on Linux. The compositor appears to act exclusively on top-level windows only and not composite child windows which is what was necessary. Wayland isn’t any better. Instead it made certain things worse such as obliterating the ability to match refresh rates.
After this I can see why Qt is so popular for Linux apps. The sheer idiocy otherwise required for simple tasks is astounding. Simply toggling fullscreen is one line of code each in Win32 and Cocoa but in Linux it requires somewhere in the neighborhood of 100 which is very poorly documented and requires two completely different mechanisms depending on whether the window is currently displayed or not. There are many more examples of this.

Not at this time, no. In short, releasing binaries on Linux is an unmitigated disaster. The fact that you mentioned 4 other formats demonstrates this. However in your mention of deb/rpm, you missed the fact that these aren’t universal but instead one much be made for each target distribution. For example: a deb created for Ubuntu might work on Debian but there isn’t a guarantee (and we’ve hit places where it isn’t). Additionally there are issues across different version of the same distribution (because of different versions of libraries).

With the Plex Media Server we spent a tremendous amount of effort to mitigate these issues by using musl. However this work doesn’t extend well to a GUI app leaving the us with the disaster we left behind with the server. Building for a snap provided an easy target against which not to just package but also compile. This is very much the problem of competing standards (see xkcd: Standards) so we picked the one that’s best for us.

See aforementioned issues for reasons for the delay.

Could AppImage be considered for the future? snap is such a black box, you even have to install a service before running a single snap. AppImages just work.

3 Likes

Not at this time, no. In short, releasing binaries on Linux is an unmitigated disaster. The fact that you mentioned 4 other formats demonstrates this. However in your mention of deb/rpm, you missed the fact that these aren’t universal but instead one much be made for each target distribution. For example: a deb created for Ubuntu might work on Debian but there isn’t a guarantee (and we’ve hit places where it isn’t). Additionally there are issues across different version of the same distribution (because of different versions of libraries).

Totally understandable, distribution is absolutely a huge issue. But in those 4 other formats, I also mentioned flatpak and appimage. Both of which are universal packages, and both of which are generally preferred before snap. There is a reason popular distributions like mint, elementary OS, Pop and others explicitly remove snap from their Ubuntu base and prefer flatpak for all package installs. So it’s sad to see that you opted for snap rather than flatpak. There are a lot of users who will have a hard time with the snap. Although I understand your choice, I hope we can see flatpak (or other) as a distribution method in the future.

1 Like

Hello, I’ve been running this app on a headless Intel NUC on windows 10 for about a month now. Everything works fine, except two quirks:

if a movie is playing and none of the playback controls are touched for 20 minutes or so, the entire app stops being responsive. as in you cannot bring up the status bar, you cannot stop the movie, select chapters, etc.

If Plex is idle on the home screen, or you scrub between chapters, the video playback starts to stutter. The only way to fix it is to restart the program

Hi, I’m the person who created the PMS snap package and the Plex HTPC one as well, and I did a good chunk of the work porting it to Linux. I’d like to shed some light on the choice of packaging format.

We generally build and package all dependencies for PMS in order to make it portable. This is not viable in the case of Plex for Linux and Plex HTPC for Linux because Qt has several heavy dependencies including arcane Xorg libraries and pulseaudio. Some of which we couldn’t ship our own copy of, even if we built them. So we absolutely needed a container-like format, which leaves flatpak and snap. Snap was an obvious choice for several reasons:

  • Prior know-how within the company because of the PMS snap
  • Good documentation
  • Ubuntu and (most) Ubuntu-based distros (which are still the majority of Linux installations) shipping snapd by default
  • Central repository/store to install from (although flathub has kinda become a de-facto standard)
  • Good installation experience for users installing from the web or the software store

Due to the association with Canonical, there is a lot of bad will going around against snap as a packaging format. On a purely technical level, it is on-par or better than flatpak and the case against it boils down to one’s views of Canonical. Honestly, I don’t really care about that stuff and made the decision based on the above criteria. This is not a case against flatpak but a case for snap. I personally run software installed with both technologies and I’m equally happy with them.

I am not opposed to also creating a flatpak later on (but, no promises). However, I did look into doing that when I started working on this and the documentation is very lacking. That’s not a show-stopper but certainly makes things much more difficult.

We could also offer an alternative download for an AppImage. However, these are really not that portable as people think. An AppImage is a little more than a glorified tarball and does nothing to shield you from glibc incompatibility. That would be a big problem for us because we build everything in 21.04 and that ships a newer glibc than 20.04 LTS. Which means these binaries (appimage or not) will not run on pre-21.04 versions or other distros with old glibc versions.

I still think it’s possible that we will eventually offer an alternative appimage or tarball download somewhere but we will need to make it obvious that those would be unsupported, I-know-what-I’m-doing builds (again, that’s not a promise).

2 Likes

It’s been almost a year and I still don’t see my play & pause buttons working… Is it working for anyone else? Would also like page-up and page-down buttons to work to scroll through the list of media. All of this used to work with PMP… I’m using a Harmony remote configured with standard windows media functionality. The play/pause/page-up/down on my USB keyboard also don’t do anything in Plex HTPC…

I’m using a Logitech 650 with HTPC and all media buttons work fine.

Play, pause, FF and Rew.

I also use a Logitech K400+ keyboard and all those media keys work as well.

Hmm… Mine is set for
“Play (Media Center PC)” and “Pause (Media Center PC)” and they don’t work…

But for some reason, “Stop (Media Center PC)” has always worked as the stop button…

I just tried “Play (PC Keyboard)” and “Pause (PC Keyboard)” and they still don’t work.

Now that I know it could work… Would you please tell me what device you’re using for the play/pause buttons?! Thanks in advanced!!!

For our main HTPC I use the manufacturer set as Microsoft and the model as PLEX with the Harmony 650

The keyboard works as is with no special key mapping - K400+

For our HTPC upstairs I use the manufacturer as Flirc and the model as PLEX as I have Flirc USB receiver for a Logitech 650.

All buttons work as expected.

Thanks for the new player, I’ve been using it for about 6 months or so now and have a couple of issues if there’s any fixes coming/workarounds known?

  1. My audio settings keep resetting. The Device keeps defaulting back to “Autoselect” and then doesn’t do passthru so I have to manually set it back to my AVR and then it works fine for a while

  2. When setting the audio settings as above if I’ve already started watching a file and then exit out to change the audio device then once configured I can’t watch any videos again. They load and then just freeze frame without attempting to play. I’ve had this almost every time and then have to completely quit the app to get it to work again

  3. I’ve got the same stuttering issue that’s been reported in this thread. It seems to be fixed by just scrubbing back a few times each time it starts but it’s almost guaranteed to stutter if I start a new playback, pause it or sometimes it just develops overtime during a movie over the course of about 30 mins or so before I have to scrub back a few seconds to fix it again.

Thanks for all the work and development!

With Plex HTPC, are you able to select and start playing, say a movie from the tiled poster page, just by pressing the play button?

Thanks. I spent hours playing with my setup and still not getting it to work. I tried Play/pause buttons using “Microsoft Windows Media Center SE”, “Microsoft MCE Keyboard”, “Microsoft PLEX”, “Microsoft OVU400003/00”, “Plex Plex Player”, and “Flirc Plex”.

No matter what I try, it doesn’t work and key even loggers don’t see any keys pressed. It seems I’m only able to generate WM_APPCOMMAND events such as APPCOMMAND_MEDIA_PLAY (46) and APPCOMMAND_MEDIA_PAUSE (47) and Plex HTPC just isn’t responding to those.

What’s strange is that my keyboard is a Logitech solar keyboard (K750) and it has a Play/Pause combination key (Fn+F7)… Even event loggers can see this key being pressed (keycode 179), but Plex HTPC doesn’t seem to respond to it at all.

I still have Plex Media Player (PMP) installed and it responds to the Play and Pause buttons perfectly. Even VNC and Windows Media Player responds to the Play Pause buttons fine.

So, I started to explore the key mapping and in the logs, I found that Plex is seeing my Play and Pause buttons as:

[InputManager] Input received: source: Keyboard keycode: Media Play:3
and
[InputManager] Input received: source: Keyboard keycode: Media Pause:3

I tried to add these key mappings to the keyboard.json file, but it wouldn’t take. The file reverts every time I restart Plex HTPC. I tried a separate .json file with the same idmatcher: “Keyboard.*”, but it still doesn’t work. Maybe I need to start another thread here.

EDIT: Figured out that I needed to copy the keyboard.json file from the default directory up one level to its parent directory. I can then edit it there. My Play and Pause buttons finally work!!!

That’s great you got it to work!
Can you pls attach your updated .json file so others can see how you did it.?

Usually this occurs when there is some interaction with the app when the AVR is off. I usually only see this when Windows decides to reboot on its own (I expect software update reasons) and HTPC auto-launches on boot with the AVR/TV off.

That is certainly unusual. Sounds like it may be attempting to initialize the audio device and failing. Logs would be helpful here.

By reading the above, I’m guessing that this is copying the json file out of the default directory and then adding:

    "Media Play": "play",
    "Media Pause": "pause",

Do many have these keys sent? We could add them to the default mapping in future versions.