nginx playback won't start until next request

Viewed 24

Sometimes when I try to load video/audio or seek, it won't start until I load or just resume playback of some other (or the same) video/audio on another page.

Also, I found that if I try to seek audio to ~1:50 and after seeking to ~0:22 this also breaks playback and sometimes the browser hangs up. (Firefox only)

Audio/Video loaded through <audio src="...">/<video src="..."> tags.

Video: https://www.youtube.com/watch?v=jY0JsnEJPgg

nginx.conf (on video):

worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;

events {
    worker_connections 1024;
}

http {
    charset utf-8;
    
    log_format compression '[$time_local] '
                           '"$request" $status $body_bytes_sent '
                           '"$http_referer"';
    
    access_log /var/log/nginx/access.log compression;

    include             /etc/nginx/mime.types;
    default_type        application/octet-stream;
    
    keepalive_timeout 60;
    types_hash_max_size 4096;
    
    upstream clem {
        server 127.0.0.1:25002; # Flask
    }
    
    upstream arch {
        server 127.0.0.1:25001;
    }

    server {
        listen 25000;
        
        location /app/ {
            proxy_pass http://clem/;
            proxy_pass_request_headers on;
            allow 127.0.0.1;
            deny all;
        }
        
        location /content/ {
            proxy_pass http://arch/;
            proxy_pass_request_headers on;
            allow 127.0.0.1;
            deny all;
        }
    }
    
    server {
        root /home/exl/—1—ARCHIVE—1—/;
        listen 25001;
        
        location / {
            autoindex on;
            allow 127.0.0.1;
            deny all;
        }
    }
}

nginx.conf (what I have tried, also with different values):

worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;

events {
    worker_connections 1024;
}

http {
    charset utf-8;
    
    log_format compression '[$time_local] '
                           '"$request" $status $body_bytes_sent '
                           '"$http_referer"';
    
    access_log /var/log/nginx/access.log compression;

    include             /etc/nginx/mime.types;
    default_type        application/octet-stream;
    
    proxy_buffering off;
    
    types_hash_max_size 4096;
    types_hash_bucket_size 128;
    
    keepalive_timeout 60;
    reset_timedout_connection on;
    client_body_timeout 30;
    client_header_timeout 30;
    
    sendfile on;
    sendfile_max_chunk 256M;
    
    aio threads;
    aio_write off;
    
    output_buffers 4 1m;
    
    directio 256M;
    
    tcp_nopush on;
    tcp_nodelay on;
    
    gzip off;
    gzip_static off;
    
    
    client_max_body_size 1000M;

    
    upstream clem {
        server 127.0.0.1:25002;
    }
    
    upstream arch {
        server 127.0.0.1:25001 max_fails=2 fail_timeout=1s;
    }

    server {
        listen 25000;
        #error_page 497 301 =307 https://$host:$server_port$request_uri;
        
        location /app/ {
            proxy_pass http://clem/;
            proxy_pass_request_headers on;
            allow 127.0.0.1;
            deny all;
        }
        
        location /content/ {
            proxy_pass http://arch/;
            proxy_pass_request_headers on;
            allow 127.0.0.1;
            deny all;
        }
    }
    
    server {
        root /home/exl/—1—ARCHIVE—1—/;
        listen 25001;
        
        location ~* \.(mp4|webm|opus|mp3)$ {
            add_header Last-Modified $date_gmt;
            add_header Cache-Control 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
            if_modified_since off;
            expires off;
            etag off;
    }
        
        location / {
            autoindex on;
            allow 127.0.0.1;
            deny all;
        }
    }
}

access.log (url decoded):

[21/Sep/2022:18:16:00 +0200] "GET /app/view?id=3447 HTTP/1.1" 302 221 "-"
[21/Sep/2022:18:16:00 +0200] "GET /app/view?id=3448 HTTP/1.1" 302 221 "-"
[21/Sep/2022:18:16:00 +0200] "GET /app/view?id=3449 HTTP/1.1" 302 221 "-"
[21/Sep/2022:18:16:00 +0200] "GET /app/view?id=3450 HTTP/1.1" 200 1365 "-"
[21/Sep/2022:18:16:01 +0200] "GET /app/static/css/view.css HTTP/1.1" 200 884 "http://127.0.0.1:25000/app/view?id=3450"
[21/Sep/2022:18:16:01 +0200] "GET /app/static/css/style.css HTTP/1.1" 200 2201 "http://127.0.0.1:25000/app/view?id=3450"
[21/Sep/2022:18:16:01 +0200] "GET /app/static/js/view.js HTTP/1.1" 200 2136 "http://127.0.0.1:25000/app/view?id=3450"
[21/Sep/2022:18:16:01 +0200] "GET /app/static/js/entry.js HTTP/1.1" 200 790 "http://127.0.0.1:25000/app/view?id=3450"
[21/Sep/2022:18:16:01 +0200] "GET /—4—icons—4—/edit.svg HTTP/1.0" 200 1147 "http://127.0.0.1:25000/app/view?id=3450"
[21/Sep/2022:18:16:01 +0200] "GET /content/—4—icons—4—/edit.svg HTTP/1.1" 200 1147 "http://127.0.0.1:25000/app/view?id=3450"
[21/Sep/2022:18:16:01 +0200] "GET /—4—icons—4—/next.svg HTTP/1.0" 200 1109 "http://127.0.0.1:25000/app/view?id=3450"
[21/Sep/2022:18:16:01 +0200] "GET /content/—4—icons—4—/next.svg HTTP/1.1" 200 1109 "http://127.0.0.1:25000/app/view?id=3450"
[21/Sep/2022:18:16:01 +0200] "GET /—4—icons—4—/minimize.svg HTTP/1.0" 200 1579 "http://127.0.0.1:25000/app/view?id=3450"
[21/Sep/2022:18:16:01 +0200] "GET /content/—4—icons—4—/minimize.svg HTTP/1.1" 200 1579 "http://127.0.0.1:25000/app/view?id=3450"
[21/Sep/2022:18:16:01 +0200] "GET /—4—icons—4—/delete.svg HTTP/1.0" 200 1124 "http://127.0.0.1:25000/app/view?id=3450"
[21/Sep/2022:18:16:01 +0200] "GET /content/—4—icons—4—/delete.svg HTTP/1.1" 200 1124 "http://127.0.0.1:25000/app/view?id=3450"
[21/Sep/2022:18:16:01 +0200] "GET /audio/opus_lossless/Leo Rojas — Albatross (2013)/07 Now I Feel Alive.opus HTTP/1.0" 206 4373242 "http://127.0.0.1:25000/app/view?id=3450"
[21/Sep/2022:18:16:01 +0200] "GET /content/audio/opus_lossless/Leo Rojas — Albatross (2013)/07 Now I Feel Alive.opus HTTP/1.1" 206 4373242 "http://127.0.0.1:25000/app/view?id=3450"
[21/Sep/2022:18:16:01 +0200] "GET /app/static/css/colors.css HTTP/1.1" 200 341 "http://127.0.0.1:25000/app/static/css/style.css"
[21/Sep/2022:18:16:01 +0200] "GET /audio/opus_lossless/Leo Rojas — Albatross (2013)/07 Now I Feel Alive.opus HTTP/1.0" 206 15098 "http://127.0.0.1:25000/app/view?id=3450"
[21/Sep/2022:18:16:01 +0200] "GET /content/audio/opus_lossless/Leo Rojas — Albatross (2013)/07 Now I Feel Alive.opus HTTP/1.1" 206 15098 "http://127.0.0.1:25000/app/view?id=3450"
[21/Sep/2022:18:16:01 +0200] "GET /app/api/entry?id=3450 HTTP/1.1" 200 348 "http://127.0.0.1:25000/app/view?id=3450"
[21/Sep/2022:18:16:01 +0200] "GET /app/api/wisdom?id=3450 HTTP/1.1" 200 0 "http://127.0.0.1:25000/app/view?id=3450"
[21/Sep/2022:18:16:01 +0200] "GET /—4—icons—4—/favicon.ico HTTP/1.0" 200 9662 "http://127.0.0.1:25000/app/view?id=3450"
[21/Sep/2022:18:16:01 +0200] "GET /content/—4—icons—4—/favicon.ico HTTP/1.1" 200 9662 "http://127.0.0.1:25000/app/view?id=3450"
[21/Sep/2022:18:16:03 +0200] "GET /audio/opus_lossless/Leo Rojas — Albatross (2013)/07 Now I Feel Alive.opus HTTP/1.0" 206 4242170 "http://127.0.0.1:25000/app/view?id=3450"
[21/Sep/2022:18:16:03 +0200] "GET /content/audio/opus_lossless/Leo Rojas — Albatross (2013)/07 Now I Feel Alive.opus HTTP/1.1" 206 4242170 "http://127.0.0.1:25000/app/view?id=3450"
[21/Sep/2022:18:16:16 +0200] "GET /audio/opus_lossless/Leo Rojas — Albatross (2013)/01 Colors of the Rainbow.opus HTTP/1.0" 206 5107079 "http://127.0.0.1:25000/app/view?id=3444"
[21/Sep/2022:18:16:16 +0200] "GET /content/audio/opus_lossless/Leo Rojas — Albatross (2013)/01 Colors of the Rainbow.opus HTTP/1.1" 206 5107079 "http://127.0.0.1:25000/app/view?id=3444"

error.log: Empty

OS: Fedora Linux 36

SELinux (getenforce): Disabled

nginx: 1.22.0

p.s. I am completely new to nginx and sorry for bad English. Thanks for your time.

1 Answers

The problem gone after rebooting and updating system.

Related