Feature #5633

Connection times out if playback paused

Added by Jasper Taylor over 4 years ago. Updated 12 months ago.

Target version:
Start date:
Due date:
% Done:


Estimated time:


When using tvheadend as a dvr, I find that when playing a recorded program via the web interface, if I pause it for more than a few minutes, then after restarting playback the cache in the player gradually empties and playback stops when it is empty. I understand that this is because of a 'time out' feature, and that this is included because if playing a live stream there is a limit to how much hav be buffered in the server. But why does there need to be a time out when replaying a recording?



Updated by Jaroslav Kysela over 4 years ago

DVR files are served in the HTTP server, so the 'timeout' from the streaming profiles is not used. But there's TCP timeout set to 30 seconds, so the kernel closes the TCP connection when idle (the receiver is not accepting more data). The purpose is to detect and close the stalled connections. My suggestion is to fix the client, not the server side (the client may re-open new connection and ask for data from the last received position in this case).


Updated by Flole Systems over 4 years ago

I think that behavior should be configurable (if not completely removed), a connection should never be stalled (that can only happen if the client has a bug) in the first place, if the client disappears on the network the tcp connection will drop anyways so I don't see any use for this kind of behavior...


Updated by Jasper Taylor 12 months ago

Necroposting a follow-up to my own issue: I got round it by making the recordings available via Apache. But I want to go back to using the built-in server in tvheadend. The problem seems to be that if the TCP connection closes, the client (mpv in this case) does try to reconnect but if a certain time has passed since starting playback, it gets HTTP Error 401: Unauthorized because the ticket URL only has a certain lifespan. Any clue to fix would be welcome.


Updated by Jasper Taylor 12 months ago

OK you can go back to sleep, I figured out how to do this with a persistent authentication code.

Also available in: Atom PDF