Client to Hardware tuner flow?

Want to write your own code to work with a HDHomeRun or work with the HDHomeRun DVR? We are happy to help with concepts, APIs, best practices.
Post Reply
jbeez
Posts: 18
Joined: Mon Nov 14, 2022 8:08 am
x 3

Client to Hardware tuner flow?

Post by jbeez »

Does anyone have a flow diagram between the HDHomeRun client and an HDHomeRun Prime, also client to ServIO?


I know that the client opens, and it sends a discovery broadcast out -> UDP:65001
at some point the client maybe gets a response, and then sends a request -> TCP:80 to get the channel lineup from the prime?
Then it picks a channel and you get the Prime sending data to the client -> TCP:5004 ?

Are there other steps I'm missing? also I have zero experience with the ServIO I'm going to try and look at that soon, but if someone already knows the flow it would save me some time!

TY

nickk
Silicondust
Posts: 19083
Joined: Tue Jan 13, 2004 9:39 am
x 157

Re: Client to Hardware tuner flow?

Post by nickk »

The app sends a discover request (UDP port 65001 to 255.255.255.255 and FF02:176 via all local IPs)
Both the Prime and the Servio respond.
The app requests /lineup.json for each tuner device (ie the Prime) to build a super-set list of channels.

To watch Live TV the app first tries sending the request to Servio-Base-URL/auto/vNNN?ClientID=X&SessionID=Y
where:
NNN is the virtual channel number.
ClientID is a UUID to identify a unique client that is changing channel (if you do picture in picture then main and sub have there own ClientID). Important to use the same ClientID each time you change channel so the Servio knows you no longer want the previous channel. Ok to generate the ClientID anew each time the app is launched.
SessionID is a 32-bit hex random number that changes each time the user changes channel. This is so the Servio can tell if you are seeking (same SessionID) or are retuning the same channel (different SessionID, for example if the user exits live TV mode then enters again).

Fallback - if the play request to the Servio fails then issue a tune request directly to the tuner using the PlayURL from the lineup.json. No additional parameters needed.

jbeez
Posts: 18
Joined: Mon Nov 14, 2022 8:08 am
x 3

Re: Client to Hardware tuner flow?

Post by jbeez »

Thanks Nick,

I’m actually trying to do something a little overly complicated.

I have two Primes and a ServIO. 1 Prime is on 172.22.1.50 and the other 172.22.22.6. The ServIO is on 172.22.22.5.
Everything works great *here*. PFSense is running UDP Broadcast Relay and it sends the discovery packets from clients on the lan(172.22.1.x) to the other vlan fine.

Other working configurations:
Remote site(A few of these actually) with an edgerouterlite 3 port, running SOCAT, and wireguard. site2site wireguard connects to pfsense box. relays the client broadcasts to 1.50, works great, haven’t looked into relaying to the other tuner/DVR yet.

Remote site with a unifi UDR and an edgerouterX. I couldn’t get wireguard site2site to work on the UDR in a stable fashion. I put an ERX there on 192.168.1.2, does wireguard site2site, and runs SOCAT. HDHR client working great, connects to 172.22.1.50. Static route in the UDR to point to the ERX working fine.

Not working,
Remote site with FiOS gateway, not a lot of options on that. I’ve put an RPI there, it connects wireguard, tunnel connects. Have a static route in the verizon router. I am having some issues here with traffic and not sure what’s causing it yet. The interesting thing here is that this “remote site” FiOS router is actually next door to me and we share the same upstream ISP gateway. The latency is spectacular like 1-2ms. We both have /56 v6 blocks from the ISP. I’m trying to leverage just the public IP range to make this work but I keep hitting roadblocks. I’ve tried doing things with nginx reverse proxy, set alias IPs on that RPI to the IPs of the 172.22.22.5/6 devices, have a substitute rule to replace all occurrences of the 172.22.22.x with the public IP. I see the requests to the DVR seem to pull /discover.json and the requests to the tuner pull lineup.json. Does the client ever pull discover.json from the tuners? I know the DVR also streams over 80/tcp to the clients.

I see the DVR looks like it supports v6, does the Prime support v6?

nickk
Silicondust
Posts: 19083
Joined: Tue Jan 13, 2004 9:39 am
x 157

Re: Client to Hardware tuner flow?

Post by nickk »

Clients pull /discover.json from tuners.

Servio supports IPv6 when running recent firmware, along with HDHR5, HDFX, and HDVR models.
HDHR4 and HDTC models support IPv6 as of firmware 20221202 (2 days ago).
Prime (HDHR3-CC) does not support IPv6 (no IPv6 support in the OS).

Post Reply