Giter VIP home page Giter VIP logo

Comments (11)

Flobbes avatar Flobbes commented on June 14, 2024

I am having the same problem, my jellyfin instance is running in a docker. When I update / reboot it, the websocket connection seems to not be reestablished.

I noticed it by two things:

  • "Play on" / cast doesn't show the kodi client anymore
  • The automatic syncing between jellyfin and kodi breaks.

System (please complete the following information):

  • OS: LibreElec 11.0.3
  • Jellyfin Version: 10.8.13
  • Kodi Version: 20.2
  • Addon Version: 7.11.py3
  • Playback Mode: Addon

from jellyfin-kodi.

Adam1986 avatar Adam1986 commented on June 14, 2024

Noticing the same on my setup too having moved from PKC to Jellyfin. I don't keep my server powered on overnight and then notice that all my clients are disconnected until Kodi is restarted etc.

PKC did seem to react quite well with Plex been offline & then re-establishing the connectivity etc.

Hopefully its a minor change that will make a big improvement if this can be sorted.

from jellyfin-kodi.

smcmnz avatar smcmnz commented on June 14, 2024

I've created a PR which fixed this in my setup. After reconnecting the websocket a small delay is needed before the client capabilities are registered or the session ends up in a state where it is does not report as use controllable and doesn't appear in the play on dialog.

Tested through different reconnect scenarios, client reappears in Play On and play status sync resumes.

from jellyfin-kodi.

Adam1986 avatar Adam1986 commented on June 14, 2024

I've created a PR which fixed this in my setup. After reconnecting the websocket a small delay is needed before the client capabilities are registered or the session ends up in a state where it is does not report as use controllable and doesn't appear in the play on dialog.

Tested through different reconnect scenarios, client reappears in Play On and play status sync resumes.

Thanks so much for taking a look at a resolution for this.

Is it sufficient to just edit the files manually that you changed or does other work need doing? Only ask as I tried editing the files manually on my setup & tried it on a client and it appeared to make no difference.

from jellyfin-kodi.

smcmnz avatar smcmnz commented on June 14, 2024

Is it sufficient to just edit the files manually that you changed or does other work need doing? Only ask as I tried editing the files manually on my setup & tried it on a client and it appeared to make no difference.

You'll need to restart Kodi to reconnect using the new client options. If it does not reconnect can you enable debug mode in the addon and submit the log of an interrupted connection.

from jellyfin-kodi.

Adam1986 avatar Adam1986 commented on June 14, 2024

Is it sufficient to just edit the files manually that you changed or does other work need doing? Only ask as I tried editing the files manually on my setup & tried it on a client and it appeared to make no difference.

You'll need to restart Kodi to reconnect using the new client options. If it does not reconnect can you enable debug mode in the addon and submit the log of an interrupted connection.

Yeah I immediately restarted after making the changes to the files. I'll look at doing debug mode tomorrow and submitting that. Assuming debug just gets output to the main kodi.log file?

Cheers

from jellyfin-kodi.

Adam1986 avatar Adam1986 commented on June 14, 2024

OK so from looking at two of my clients, it seems that if the connection is disrupted from the server side (I.E service stopped) when that comes back up connectivity comes back fine:

2024-01-31 10:10:38.667 T:1277     info <general>: JELLYFIN.jellyfin_kodi.jellyfin.ws_client -> ERROR::jellyfin_kodi/jellyfin/ws_client.py:70 [Errno 104] Connection reset by peer
2024-01-31 10:15:28.781 T:1277     info <general>: JELLYFIN.jellyfin_kodi.jellyfin.ws_client -> INFO::jellyfin_kodi/jellyfin/ws_client.py:73 --->[ websocket opened ]
2024-01-31 10:15:29.793 T:1277     info <general>: JELLYFIN.jellyfin_kodi.jellyfin.http -> DEBUG::jellyfin_kodi/jellyfin/http.py:84 --->[ http ] {
                                                       "params": null,
                                                       "json": {
                                                           "PlayableMediaTypes": "Audio,Video",
                                                           "SupportsMediaControl": true,
                                                           "SupportedCommands": "MoveUp,MoveDown,MoveLeft,MoveRight,Select,Back,ToggleContextMenu,ToggleFullscreen,ToggleOsdMenu,GoHome,PageUp,NextLetter,GoToSearch,GoToSettings,PageDown,PreviousLetter,TakeScreenshot,VolumeUp,VolumeDown,ToggleMute,SendString,DisplayMessage,SetAudioStreamIndex,SetSubtitleStreamIndex,SetRepeatMode,Mute,Unmute,SetVolume,Play,Playstate,PlayNext,PlayMediaSource"
                                                       },
                                                       "type": "POST",
                                                       "url": "http://{jellyfin-server}/Sessions/Capabilities/Full",
                                                       "headers": {
                                                           "Content-type": "application/json",
                                                           "Accept-Charset": "UTF-8,*",
                                                           "Accept-encoding": "gzip",
                                                           "User-Agent": "Jellyfin-Kodi/0.7.11+py3",
                                                           "x-emby-authorization": "MediaBrowser Client=Kodi, Device=KITCHEN-FD, DeviceId=37ffbbad-8ecc-4711-911c-53c64adcd0d3, Version=0.7.11+py3, UserId=652370786690407d9644918c90401e00",
                                                           "X-MediaBrowser-Token": "{jellyfin-token}"
                                                       },
                                                       "timeout": 30,
                                                       "verify": true
                                                   }
2024-01-31 10:15:29.929 T:1277     info <general>: JELLYFIN.jellyfin_kodi.helper.utils -> DEBUG::jellyfin_kodi/helper/utils.py:152 ---[ event: plugin.video.jellyfin/ForceKeepAlive ] "[60]"
2024-01-31 10:16:17.203 T:1277     info <general>: JELLYFIN.jellyfin_kodi.helper.utils -> DEBUG::jellyfin_kodi/helper/utils.py:152 ---[ event: plugin.video.jellyfin/ForceKeepAlive ] "[60]"

But if the connectivity was disrupted on the client side, I.E by me dropping the Wi-Fi connection, then something seems to go awry, I knocked the connection offline at about 10:24 but do not see a "connection reset by peer" like before, several minutes later Jellyfin does appear to make a connection again to the server, but no sync data comes through, and the client does not show back up in the "Play On" via my Android App:

2024-01-31 10:33:33.185 T:1277     info <general>: JELLYFIN.jellyfin_kodi.jellyfin.ws_client -> INFO::jellyfin_kodi/jellyfin/ws_client.py:73 --->[ websocket opened ]
2024-01-31 10:33:34.198 T:1277     info <general>: JELLYFIN.jellyfin_kodi.jellyfin.http -> DEBUG::jellyfin_kodi/jellyfin/http.py:84 --->[ http ] {
                                                       "params": null,
                                                       "json": {
                                                           "PlayableMediaTypes": "Audio,Video",
                                                           "SupportsMediaControl": true,
                                                           "SupportedCommands": "MoveUp,MoveDown,MoveLeft,MoveRight,Select,Back,ToggleContextMenu,ToggleFullscreen,ToggleOsdMenu,GoHome,PageUp,NextLetter,GoToSearch,GoToSettings,PageDown,PreviousLetter,TakeScreenshot,VolumeUp,VolumeDown,ToggleMute,SendString,DisplayMessage,SetAudioStreamIndex,SetSubtitleStreamIndex,SetRepeatMode,Mute,Unmute,SetVolume,Play,Playstate,PlayNext,PlayMediaSource"
                                                       },
                                                       "type": "POST",
                                                       "url": "http://{jellyfin-server}/Sessions/Capabilities/Full",
                                                       "headers": {
                                                           "Content-type": "application/json",
                                                           "Accept-Charset": "UTF-8,*",
                                                           "Accept-encoding": "gzip",
                                                           "User-Agent": "Jellyfin-Kodi/0.7.11+py3",
                                                           "x-emby-authorization": "MediaBrowser Client=Kodi, Device=KITCHEN-FD, DeviceId=37ffbbad-8ecc-4711-911c-53c64adcd0d3, Version=0.7.11+py3, UserId=652370786690407d9644918c90401e00",
                                                           "X-MediaBrowser-Token": "{jellyfin-token}"
                                                       },
                                                       "timeout": 30,
                                                       "verify": true
                                                   }
2024-01-31 10:34:05.260 T:1277     info <general>: JELLYFIN.jellyfin_kodi.jellyfin.http -> ERROR::jellyfin_kodi/jellyfin/http.py:124 405 Client Error: Method Not Allowed for url: http://{jellyfin-server}/Sessions/Capabilities/Full
2024-01-31 10:34:05.265 T:1277     info <general>: JELLYFIN.jellyfin_kodi.jellyfin.ws_client -> ERROR::jellyfin_kodi/jellyfin/ws_client.py:70 (405, HTTPError('405 Client Error: Method Not Allowed for url: http://{jellyfin-server}/Sessions/Capabilities/Full'))
2024-01-31 10:34:05.272 T:1277     info <general>: JELLYFIN.jellyfin_kodi.helper.utils -> DEBUG::jellyfin_kodi/helper/utils.py:152 ---[ event: plugin.video.jellyfin/ForceKeepAlive ] "[60]"
2024-01-31 10:34:21.239 T:1277     info <general>: JELLYFIN.jellyfin_kodi.helper.utils -> DEBUG::jellyfin_kodi/helper/utils.py:152 ---[ event: plugin.video.jellyfin/ForceKeepAlive ] "[60]"

from jellyfin-kodi.

smcmnz avatar smcmnz commented on June 14, 2024

Your log shows the websocket is reconnected but the API call to register the capabilities fails with 405 Client Error: Method Not Allowed this API call is what makes the player visible in the Play On dialog.

Can you try increasing the time.sleep() I added to see if it helps. I found without a sleep the API call will 405, 1 second worked in my setup but I'm not sure what Jellyfin is doing after the websocket connects

from jellyfin-kodi.

Adam1986 avatar Adam1986 commented on June 14, 2024

OK so I increased this to 60 seconds and tested again, this has improved somewhat as I now see the device in my Play To section on the Android App.

However nothing works still from syncing the play progress perspective and this does not update/change.

2024-01-31 23:24:22.902 T:2733     info <general>: JELLYFIN.jellyfin_kodi.jellyfin.ws_client -> ERROR::jellyfin_kodi/jellyfin/ws_client.py:70 [Errno 101] Network is unreachable
2024-01-31 23:24:33.037 T:2733     info <general>: JELLYFIN.jellyfin_kodi.jellyfin.ws_client -> INFO::jellyfin_kodi/jellyfin/ws_client.py:73 --->[ websocket opened ]
2024-01-31 23:25:33.047 T:2733     info <general>: JELLYFIN.jellyfin_kodi.jellyfin.http -> DEBUG::jellyfin_kodi/jellyfin/http.py:84 --->[ http ] {
                                                       "params": null,
                                                       "json": {
                                                           "PlayableMediaTypes": "Audio,Video",
                                                           "SupportsMediaControl": true,
                                                           "SupportedCommands": "MoveUp,MoveDown,MoveLeft,MoveRight,Select,Back,ToggleContextMenu,ToggleFullscreen,ToggleOsdMenu,GoHome,PageUp,NextLetter,GoToSearch,GoToSettings,PageDown,PreviousLetter,TakeScreenshot,VolumeUp,VolumeDown,ToggleMute,SendString,DisplayMessage,SetAudioStreamIndex,SetSubtitleStreamIndex,SetRepeatMode,Mute,Unmute,SetVolume,Play,Playstate,PlayNext,PlayMediaSource"
                                                       },
                                                       "type": "POST",
                                                       "url": "http://{jellyfin-server}/Sessions/Capabilities/Full",
                                                       "headers": {
                                                           "Content-type": "application/json",
                                                           "Accept-Charset": "UTF-8,*",
                                                           "Accept-encoding": "gzip",
                                                           "User-Agent": "Jellyfin-Kodi/0.7.11+py3",
                                                           "x-emby-authorization": "MediaBrowser Client=Kodi, Device=KITCHEN-FD, DeviceId=37ffbbad-8ecc-4711-911c-53c64adcd0d3, Version=0.7.11+py3, UserId=652370786690407d9644918c90401e00",
                                                           "X-MediaBrowser-Token": "{jellyfin-token}"
                                                       },
                                                       "timeout": 30,
                                                       "verify": true
                                                   }
2024-01-31 23:25:33.081 T:2733     info <general>: JELLYFIN.jellyfin_kodi.helper.utils -> DEBUG::jellyfin_kodi/helper/utils.py:152 ---[ event: plugin.video.jellyfin/ForceKeepAlive ] "[60]"

from jellyfin-kodi.

smcmnz avatar smcmnz commented on June 14, 2024

From your comments are you making changes to watch/play state with the client offline and they are not syncing on reconnect? If after you reconnect you mark an item is watched does that come through? i.e. does the reconnect and subsequent sync work?

I tested blocking my client, updating a watch status on the server and unblocking 10 minutes later, the status event came through within 60 seconds of being unblocked. This looks to be handled by the websocket reconnect param. I didn't get a websocket opened message. I guess the change events were buffered by the server.

If I do the above and also tcpkill the socket I can reproduce the problem, the client is online and gets changes going forward but not anything that occurred while disconnected. Perhaps the client needs to request a full or partial (Via Kodi sync queue) library update on reconnect which is currently done on plugin startup.

I could look at triggering a sync for changes on reconnect. Doing a full sync feels too much and may have negative impact on clients that reconnect frequently for whatever reason.

from jellyfin-kodi.

oddstr13 avatar oddstr13 commented on June 14, 2024

from jellyfin-kodi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.