Open garbled1 opened 2 years ago
OK, so, in firefox, when I pull up the list of remote devices, even though plexdlnaplayer has 3 devices, I only see one of the three. If I watch the network, your code responds with GDM responses for all 3 devices that I have, in order.
What I've discovered, is that the web player only "sees" the last one to respond.. meaning, if plexdlnaplayer replies with "Device A", "Device B", "Device C" in order, only C is seen. If I restart it, and the order changes, say to B,C,A it only sees "A".
My phone however, is totally random. It will see 2-3 devices sometimes, and most of the time none. Plexamp never sees them.
Interestingly, plexamp sees my mobile devices all the time, pretty much religiously, so, there is a difference there, I'm not sure what..
tcpdump from a mobile device running the plex app.
06:45:41.896439 IP Galaxy-S9.garbled.net.32412 > musica.58487: UDP, length 361
E.....@.@..=......
M~..w.q!.HTTP/1.0 200 OK
Content-Type: plex/media-player
Resource-Identifier: 5adf45b5d3f68ae7-com-plexapp-android
Updated-At: 1639229598
Version: 8.26.2.29389
Protocol-Version: 1
Port: 32500
Product: Plex for Android (Mobile)
Protocol: plex
Device-Class: mobile
Protocol-Capabilities: timeline,playback,mirror,playqueues,provider-playback
Name: Galaxy S9
Tcpdump from the DLNA player (I added Updated-At:, which seems to help a little bit..)
07:12:12.077234 IP mirzam.garbled.net.32412 > musica.58487: UDP, length 298
E..F.+@.@.....
N..
M~..w.2./HTTP/1.0 200 OK
Name: Spa Room
Port: 32488
Content-Type: plex/media-player
Product: Plex DLNA Player
Protocol: plex
Protocol-Version: 1
Protocol-Capabilities: timeline,playback,playqueues
Version: 1
Resource-Identifier: 2fbeb30e-e21a-1290-0080-0005cda8ccee
Updated-At: 1639231932
Device-Class: stb
07:12:12.077321 IP mirzam.garbled.net.32412 > musica.58487: UDP, length 297
E..E.,@.@.....
N..
M~..w.1..HTTP/1.0 200 OK
Name: Kitchen
Port: 32488
Content-Type: plex/media-player
Product: Plex DLNA Player
Protocol: plex
Protocol-Version: 1
Protocol-Capabilities: timeline,playback,playqueues
Version: 1
Resource-Identifier: a34cc3a1-6c34-1b9a-0080-0005cda88522
Updated-At: 1639231932
Device-Class: stb
07:12:12.077375 IP mirzam.garbled.net.32412 > musica.58487: UDP, length 298
E..F.-@.@.....
N..
M~..w.2./HTTP/1.0 200 OK
Name: Bathroom
Port: 32488
Content-Type: plex/media-player
Product: Plex DLNA Player
Protocol: plex
Protocol-Version: 1
Protocol-Capabilities: timeline,playback,playqueues
Version: 1
Resource-Identifier: a2d20f63-f7e0-1b18-0080-0005cdacce92
Updated-At: 1639231932
Device-Class: stb
OK, I now understand the bind to devices page better. You have to go to plex.tv, input the code, then immediately go back to the devices page, and click check linked. Unless you do this, it does not save the pin state to data.json. after doing that, suddenly plexamp can see them.
The other problem I'm having, also has to do with multi-devices. When you pick a remote player in android, it sends the following to plexdlnaplayer:
GET /resources?X-Plex-Language=en-us HTTP/1.1
Which it 404's because it doesn't include a specific device. I think, the client here is expecting a list of devices, as seen: https://github.com/plexinc/plex-media-player/wiki/Remote-control-API Under the mediacontainer docs, where it says you can return a list of devices if you support multiple devices.
What I'm unsure about, is what the proper uuid to return in the header would be. We are getting the uuid from each of the devices, so.. hrmm.
Part of me thinks the whole thing should fire up a separate web UI for each device, and just report the singular uuid and device in that one UI, so you have multiple ports, not just the 32448 one, like a range of ports. Maybe I'll try to implement that instead.
Also, just writing this one down for notes: The android client sends over when it starts/wakes up:
M-SEARCH * HTTP/1.1 HOST: "239.255.255.250:1900" MAN: "ssdp:discover" MX: 1 ST: urn:schemas-upnp-org:device:ZonePlayer:1
an Ipad sends the following, just for notes again: GET /resources?X-Plex-Language=en&X-Plex-Device-Name=Lucy%20F.%20Lucy%E2%80%99s%20iPad HTTP/1.1
I think I have this all working now in my res_fixes branch, need a bit more testing, then will PR a fix.
Wow, you've done a lot work here. I'm sorry for the late response. I'm giving all my spare time to snowboarding lately.
I didn't test any android devices and am surprised that they behave differently from the iOS devices.
I don't think firing up a separate web server for every DLNA device will be a good idea, unless necessary. A separated web server will need its separated resource, firing too many web servers up will slow down the entire server. Is there a way to return a list of devices? Since you already have some ideas, I'll just wait for your PR and do some tests.
No problem, thanks for taking a look. The problem I have is fiddly...and there are 2 sides to it:
1) When the program sends GDM's to plex, plex basically takes only the last one, because they all use the same port. 2) The android client, then turns around and connects to plexdlnaplayer, and just issues /resources, with no identifiers to see what is there. I could probably make that part work, but the headers are a bit of an issue there, and it still doesn't solve issue 1, which messes up the web client.
My solution was to fire up multiple tasks of the fastapi server, but have them all share the same DLNA data and backend, so each device is tied to a unique port. It doesn't really seem to use that much more resources than the single one. Maybe I can get some final testing in today, and PR something for you to look at.
Thanks for your work on this though, it's given me hope for having all these speakers work. I'm inches away from my ideal setup here. :)
Sorry for surfacing an old issue, but @garbled1, any luck with getting things to work? I'm basically in the same boat. I can't play to any of the DLNA renderers and I suspect it is because there are multiple. As you noted in Plex Web, I see only one random one, and it even sometimes works. Once I navigate to the bind page (took me forever to figure this part out...anyone reading this, navigate to http://
With the patch in my PR, I'm able to connect to my HEOS, and play music to them. However I have two strange problems:
1) Sometimes the devices show up on the list of remote playable things, sometimes they don't, it's kinda random and per-player. Sometimes only one of my Heos devices show up, sometimes all three.
2) On the link webpage, it always shows them as unlinked. Is the linking persistent across restarts of the application? Even if I go and link one, when I reload the bind devices page, it shows everything unlinked, even if I'm currently playing to that device.