jellyfin-media-player icon indicating copy to clipboard operation
jellyfin-media-player copied to clipboard

Add automatic (or manual) home screen refresh

Open joshuaboniface opened this issue 3 years ago • 10 comments

Is your feature request related to a problem? Please describe. Currently, the home screen of JMP never refreshes. This means that, for example, if new media is added to the library, the home screen won't update to show the new items in "Next Up"/"Latest ".

Describe the solution you'd like Some sort of automatic refresh of the homepage would be lovely. It wouldn't have to be too often, maybe every 30 or 60 seconds, and could be configurable. A "refresh" button in the top-right could also help.

Describe alternatives you've considered My current workaround is to visit a library, then return back home, but this is slightly annoying.

Additional context Since JMP is "just a wrapper" around Jellyfin Web, this might be better implemented there, but I figured I'd make the feature request here first to get your take on it - I've not noticed the issue when using Web, it seems to just occasionally refresh.

joshuaboniface avatar Nov 13 '21 01:11 joshuaboniface

I though new items were supposed to be added to the home screen by using the websocket feed without a page refresh?

iwalton3 avatar Nov 13 '21 01:11 iwalton3

That's what I figured too, but for some reason that isn't happening. I'd suspect it might be due to the websocket terminating (e.g. when my laptop goes to sleep), so perhaps periodic checks of the websocket connection are a better solution.

joshuaboniface avatar Nov 13 '21 01:11 joshuaboniface

Two considerations for the next time this happens:

  • Did you add the media while the computer was asleep?
  • Can you use PlayTo to play media on JMP from another web browser after the computer wakes up?

iwalton3 avatar Nov 13 '21 01:11 iwalton3

Did you add the media while the computer was asleep?

Sometimes yes, sometimes no, it seems to happen in either case.

Can you use PlayTo to play media on JMP from another web browser after the computer wakes up?

I'll try this now.

joshuaboniface avatar Nov 13 '21 01:11 joshuaboniface

Can you use PlayTo to play media on JMP from another web browser after the computer wakes up?

This did seem to work immediately.

Here's a Q though, what are the default websocket timeouts and such? I wonder if my HAProxy is throwing it for a loop.

joshuaboniface avatar Nov 13 '21 01:11 joshuaboniface

So interestingly enough, there is no automatic websocket reconnect on disconnect. Instead what happens is the next time the application gains focus again, it calls ensureWebSocket which will open the connection again.

https://github.com/jellyfin/jellyfin-web/blob/0831207057c26ba5d760b6e9617d05260a142f13/src/components/apphost.js#L401-L413

https://github.com/jellyfin/jellyfin-web/blob/0831207057c26ba5d760b6e9617d05260a142f13/src/components/appRouter.js#L532-L538

However, if you can PlayTo the jellyfin-media-player, that means the websocket connection is alive. One thing to note is that if media is added while the computer is asleep, JMP will not get the notification through the websocket that new media was added. This is also why Kodi needs a sync queue (although obviously for this situation we could just refresh the home page), since while Kodi listens for added items, it has to "catch up" while offline.

So I suppose the next question is does the websocket event actually get used for new media to update the home page? I know for sure it is used for "Next Up" to show the playback status.

iwalton3 avatar Nov 13 '21 01:11 iwalton3

Curious, I'm not sure, and come to think of it even when JMP is active (laptop not asleep) I've never seen it respond immediately to new media.

joshuaboniface avatar Nov 13 '21 02:11 joshuaboniface

I have been running into this since starting using it. For me it seems the websocket connection gets interrupted when I turn my screen off and it doesn't automatically come back without restarting the app. (I get refreshes, but I don't get remote control from other devices, if I just navigate to a different page).

Cadair avatar Apr 25 '22 13:04 Cadair

Would really like a refresh button on the main page to scan for new additions.

guiltlab avatar Sep 09 '22 07:09 guiltlab

for now this can be worked around by right clicking the background of any page and selecting "Refresh" Id like to convert this to a discussion, since it's not really a bug and we don't have a clear view of what the solution should look like. In fact, there is a very similar discussion open on server about automatic page updates. in my opinion this thread should be closed and linked to https://github.com/jellyfin/jellyfin/discussions/10700, our new universal location for discussing how to best provide automatic updates to the UI across the board. i will make this move eventually if I don't hear from anybody.

sevenrats avatar Jan 04 '24 19:01 sevenrats