-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle network issues in video player #5138
Handle network issues in video player #5138
Conversation
fee38e2
to
142d36a
Compare
When an error occurs for a resolution, remove the resolution and try with another resolution.
I would be very grateful if you added some logic to this PR to make the video player silenty retry on HTTP status code Taking the amount of seconds to wait for before a retry is attempted from the response header |
It seems that the status code is provided in the errorData object, so it shouldn't be hard to fix. I'll look into that. |
It seems that the status code isn't in the actual error object, it seems like a hls.js bug. video-dev/hls.js#4852 After thinking a bit that may be a separate issue since a 429 response will probably affect the user, and I think they be informed that it isn't working as expected. Do you have a proxy that respond 429 or why are you experiencing that? It doesn't seem that PeerTube are having any rate limit on the static files. |
Thanks for looking into it! 👍🏻 HTTP Status Code 429 is intended as a form of rate limiting. It tells clients to retry automatically after a cool off period, adhering to the I've configured my own PeerTube instance to send the 429 status code when requests per second on video fragments exceed a certain amount, nullifying attempts to leech bandwidth by malicious user agents. An adjustment I made to the NGINX configuration after discovering a malicious client was DoSing by requesting fragments from various IP addresses at once. It can sometimes be triggered by skipping segments really fast as well, which leads to a bad user experience; crashing the player. Made the following adjustments to the NGINX configuration. Will upstream this once I settled on the best request rate. Lower it (and/or remove burst) to trigger the 429: Within the limit_conn_zone $binary_remote_addr zone=peertube_video_ip:10m;
limit_conn_zone $server_name zone=peertube_video_total_conn:10m;
# decrease rate below to trigger 429
limit_req_zone $binary_remote_addr zone=peertube_video:10m rate=3r/s;
limit_req_status 429;
limit_conn_status 429; Within the location ~ ^/static/(webseed|redundancy|streaming-playlists)/ {
limit_conn peertube_video_total_conn 10000;
limit_conn peertube_video_ip 10;
# adjust or delete burst and delay to trigger 429 sooner
limit_req zone=peertube_video burst=4 delay=2;
limit_rate_after 5M;
set $peertube_limit_rate 800k;
if ($request_uri ~ -fragmented.mp4$) {
set $peertube_limit_rate 5M;
}
limit_rate $peertube_limit_rate; |
Hi, Can you explain why a specific resolution could be broken? |
Another usecase could be for example when watching using a spotty 4G LTE connection. |
But in that case I assume we don't want to remove the resolution from the player (which is done in this PR)? In case of a spotty connection it will retry for some times, and then go to another resolution. |
Thanks! |
Description
Handle network issues in video player.
Related issues
closes #4782
Has this been tested?
Screenshots