Register client as Plex player

Hello,



I’m working on a client to PMS called emplexer https://github.com/newloran2/emplexer, this client is a plugin to Dune Media Player.



I would to support some features like autodetect servers and Plex Client (to navigate via ios/android app and play on emplexer).



Elan post on this thread http://forums.plexapp.com/index.php/topic/37867-new-plex-remote/page__view__findpost__p__240861 the code has able to use GDM to detect servers.



I incorporated this code on my client and work very well, but i do not know how to register my client as Plex Player.



If any one tell me how to make this ( only register) i’m really grateful.





Thanks to all.

Been looking at this today (when I was trying to work out why Bonjour wasn’t working)



multicast address: 239.0.0.250 (wasn’t able to get broadcast working)

Multicast port: 32413



Message prefix

HELLO * HTTP/1.1 - to register a client

BYE * HTTP/1.1 - to deregister a client (if that is even a word)



Message body

Content-Type: plex/media-player

Resource-Identifier: [ some uuid like bd005ed8-fc0f-42de-a72b-5149d6404358 ]

Name: [ name of client ]

Port: [ port number for requests such as 3000 ]

Product: [ name of client software ]

Version: [ version of client software ]



So, a registration request would look like this:



<br />
HELLO * HTTP/1.1<br />
Content-Type: plex/media-player<br />
Resource-Identifier: bd005ed8-fc0f-42de-a72b-5149d6404358<br />
Name: plexbmc-server<br />
Port: 3000<br />
Product: PleXBMC<br />
Version: 3.0.4<br />




A simple bit of python to do this:

<br />
import time<br />
import sys<br />
import socket<br />
<br />
mcast_address = '239.0.0.250'<br />
mcast_port = 32413<br />
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP)<br />
sock.setsockopt(socket.IPPROTO_IP, socket.IP_MULTICAST_TTL, 32)<br />
<br />
data=""" * HTTP/1.0<br />
Content-Type: plex/media-player<br />
Resource-Identifier: bd005ed8-fc0f-42de-a72b-5149d6404358<br />
Name: plexbmc-server<br />
Port: 3000<br />
Product: PleXBMC<br />
Version: 3.0.4<br />
<br />
"""<br />
<br />
while 1:<br />
    try:<br />
        sock.sendto('HELLO'+data, (mcast_address, mcast_port))<br />
        time.sleep(5)<br />
    except KeyboardInterrupt:<br />
        sock.sendto('BYE'+data, (mcast_address, mcast_port))<br />
        time.sleep(1)<br />
        break<br />




The only bit I wasn't sure on was refreshing/maintaining. The registration will disappear if the client isn't seen for a period of time (somewhere around 5 seconds) - so I'm not sure whether you need to keep sending HELLO requests, or some other refresh request (or whether the server will poll the client).




hippojay,


Thank's so much, this code has you posted work's like a charm :), Thank's.

Just to add that I’ve done some more research and refined the process. The HELLO goes out on port 32413, but you also need to respond to client discovery requests on 32412. I have a python class I’ve put together which does client registration, server discovery, client discover responses and also checks a client to ensure it is still registered.



It’s part of my PleXBMC Helper app (which translates Plex remote control commands into XBMC ones)



https://github.com/hippojay/script.plexbmc.helper/blob/master/resources/lib/plexGDM.py

Just to add that I've done some more research and refined the process. The HELLO goes out on port 32413, but you also need to respond to client discovery requests on 32412. I have a python class I've put together which does client registration, server discovery, client discover responses and also checks a client to ensure it is still registered.

It's part of my PleXBMC Helper app (which translates Plex remote control commands into XBMC ones)

https://github.com/hippojay/script.plexbmc.helper/blob/master/resources/lib/plexGDM.py

Hi hippojay!

The GitHub Address seems to be out of date - 404ed.

Is the code somewhere else available?

Thanks!

Hi hippojay!

The GitHub Address seems to be out of date - 404ed.

Is the code somewhere else available?

Thanks!

New location https://github.com/hippojay/script.plexbmc.helper/blob/master/resources/lib/plexgdm.py.

New location https://github.com/hippojay/script.plexbmc.helper/blob/master/resources/lib/plexgdm.py.

Aeh... that seems to be the same link (with GDM in small letters) - and still 404'ed for me.  :(

Aeh... that seems to be the same link (with GDM in small letters) - and still 404'ed for me.  :(

try now https://github.com/hippojay/script.plexbmc.helper/blob/master/resources/lib/plexgdm.py

Great! This link works! Thank you!

Hey guys, i am brand new to plex development and I too would like to know the correct way to register a client as a player in the media server.


Why are we guessing how this works? Is there really no documentation for this? I thought various plex clients were developed by the community – is everyone reverse engineering everything?


Is there official documentation anywhere?


Thanks,

Andrew

Your best bet is to look at the code for Plex home theater or the Roku client. They are both open source so you can learn from their code how to do various things from a client perspective.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.