-
-
Notifications
You must be signed in to change notification settings - Fork 30.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Plex playing playlist of movies fails due to timeout #69815
Comments
plex documentation |
Hey there @jjlawren, mind taking a look at this issue as it has been labeled with an integration ( |
Thanks for the very thorough investigation! Definitely not a use-case I've run into myself, but seems simple enough to address. |
@charlie89 I'm curious if this works better for you in 2022.4.2. |
@jjlawren That fixed it, thanks. The video now starts playing basically instantly. |
The problem
When using the service
Media player: Play media
to play all videos of a playlist (or collection) on a plex client (Nvidia Shield) it runs into a timeout and doesn't start playing.Note: I'm not using chromecast but the plex integration to directly play on a client because this gives me access to the playlist via the plex app on my phone and i can view/add/rearrange playlist items.
The issue only affects playlists with videos, playlists with music work fine.
I already did a whole bunch of investigation:
With 8 videos in the playlist it works and takes about 20 seconds to start playing the first video, but i now have 35 videos in the playlist so it takes longer and produces an error. I figured out that the python-plexapi module runs into it's default 30 second timeout, so i added a file
~/.config/plexapi/config.ini
with a timeout of 5 minutes (300 seconds) like described here.With the increased timeout playing the 35 video playlist works, but it takes about 75 seconds for it to start playing. As my playlist will grow in the future i would have to wait even longer for it to start playing.
When using the official plex app on my android phone to play the playlist on the Nvidia Shield it starts playing instantly, so i know there's a way to make it faster.
For testing purposes i created a small script which uses the plexapi package directly to stream the playlist:
And again it took 75 seconds to start playing and it was the function
createPlayQueue
which takes so long. Then i captured the network-traffic of the plex app on my android phone (including breaking tls encryption with mitmproxy) to compare it's api requests with those from plexapi.The difference is that plexapi by default uses
includeRelated=1
in functioncreatePlayQueue
(see source) to include related videos and then the request from the plex server takes so long cause plex probably searches for related videos for every video in the playlist. When changing line 6 of the above script topq = plex.createPlayQueue(playlist, includeRelated=0)
it starts playing instantly.I don't even want plex to play related videos, just play those videos in the specified playlist. Probably that
includeRelated
flag may be used to get similar results, especially when using voice assistants (which i don't use).The homeassistant code doesn't set the
includeRelated
flag currently, so it's always on.A solution would be to add a optional flag
related
(or so) to the JSON contained inmedia_content_id
which then sets theincludeRelated
flag for plexapi'screatePlayQueue
function. Basically just likeshuffle
works.Or does someone have a better solution?
What version of Home Assistant Core has the issue?
core-2022.4.1
What was the last working version of Home Assistant Core?
No response
What type of installation are you running?
Home Assistant Container
Integration causing the issue
plex
Link to integration documentation on our website
https://www.home-assistant.io/integrations/plex/
Diagnostics information
No response
Example YAML snippet
Anything in the logs that might be useful for us?
Additional information
No response
The text was updated successfully, but these errors were encountered: