Hi guys,
I’m working on a bespoke HTPC software for my home (in C#), and I’ve been using Plex as the media server behind my application (if you’re wondering, I’m not using PMP because I’m developing a series of bespoke modules) and was looking to use the Plex playback control API to handle playing media.
I have all the other API stuff working (navigating the Plex library) with a valid Plex token, credentials, etc. However I am struggling to get the actual playback control working correctly. I’ve been using the PMP software as a basis for determining the responses and outputs required for broadcasts and for the playback control, but I can’t seem to get it working correctly.
As a proof of concept, I’ve put together a very rudimentary console application which listens on a UDP socket for the M-SEARCH broadcasts, which works perfectly (my application shows up as a player.) I’m listening on a port for HTTP/TCP connections, and am receiving the standard requests. For instance, if I receive a /player/timeline/poll?wait=0&commandID=0 I am sending back the following response:
HTTP/1.1 200 OK
Content-Type: application/xml
Access-Control-Allow-Origin: *
Access-Control-Expose-Headers: X-Plex-Client-Identifier
X-Plex-Client-Identifier:
X-Plex-Token:
However, as soon as the above response is dispatched, the Plex web interface simply pops up an error stating “There was a problem connecting to this player”. At first I believed it was because I was terminating the connection immediately after (ignoring Connection: keep-alive), however keeping the connection open doesn’t remedy the situation.
Is there some definitive guide or series of instructions I can follow to get this working? I’ve been using the PMP Github page as a basis for the basic documentation and existing code, but even effectively converting the C++ code into C# and following the same rules and principles, I can’t get this working!
Perhaps I’m missing something. If anyone can point me in the right direction, that would be amazing.
Thanks in advance!
PS. It looks like the forum is removing the HTML mark-up, so the actual value is here: pastebin.com/4424PeV5