kaltura / nginx-vod-module

NGINX-based MP4 Repackager
GNU Affero General Public License v3.0
2k stars 439 forks source link

web player problem #1141

Open HassanChoobin opened 4 years ago

HassanChoobin commented 4 years ago

Hi dears

I have no problem streaming video at the android ExoPlayer and the vlc at windows. But when the video is played on web players, some of the first ts parts run properly and the next ones stay in the loading mode, and if I move the movie back or forth, it's still in the loading mode.

More details in the video below: https://youtu.be/aBi6AlIcItw

My nginx conf is similar to the following:

#user  nobody;
worker_processes  auto;

error_log  logs/kaltura_nginx_errors.log;
error_log  logs/error.log;
error_log  logs/error.log  notice;
error_log  logs/error.log  info;

pid     logs/nginx.pid;

events {
worker_connections  1024;
worker_aio_requests 512;
multi_accept on;
use epoll;
}

http {
include    mime.types;
default_type  application/octet-stream;

log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    '$status $bytes_sent $request_time "$http_referer" "$http_user_agent" "-" - '
    '"$sent_http_x_kaltura" "$http_host" $pid $sent_http_x_kaltura_session - '
    '$request_length "$sent_http_content_range" "$http_x_forwarded_for" '
    '"$http_x_forwarded_server" "$http_x_forwarded_host" "$sent_http_cache_control" '
    '$connection ';

access_log logs/kaltura_nginx_access.log main;

# general nginx tuning
sendfile on;
tcp_nopush on;
tcp_nodelay on;

keepalive_timeout 60;
keepalive_requests 1000;
client_header_timeout 20;
client_body_timeout 20;
reset_timedout_connection on;
send_timeout 20;

# manifest compression
gzip on;
gzip_types application/vnd.apple.mpegurl video/f4m application/dash+xml text/xml text/vtt;
gzip_proxied any;

# shared memory zones
vod_metadata_cache metadata_cache 512m;
vod_response_cache response_cache 64m;
vod_performance_counters perf_counters;

# common vod settings
vod_last_modified 'Sun, 19 Nov 2000 08:52:00 GMT';
vod_last_modified_types *;
vod_expires 100d;
vod_expires_live 30;
vod_expires_live_time_dependent 3;
vod_align_segments_to_key_frames on;
vod_output_buffer_pool 64k 32;

# file handle caching / aio
open_file_cache max=1000 inactive=5m;
open_file_cache_valid 2m;
open_file_cache_min_uses 1;
open_file_cache_errors on;
aio on;

server {
    listen       80;
    server_name  www.s1.test1.com s1.test1.com;

    # vod status page
    location = /vod_status {
        vod_status;
        access_log off;
    }

    # redirect server error pages to the static page /50x.html
    error_page 500 502 503 504 /50x.html;

    location = /50x.html {
        root   html;
    }

    vod_secret_key "*************************************$vod_filepath";
    vod_hls_encryption_method aes-128;

    # serve flavor HLS
    location /hls/ {
        vod hls;
        alias /home/;

        #vod segmentation
        vod_segment_duration 5000;
        vod_align_segments_to_key_frames on;

        add_header Access-Control-Allow-Headers "Origin,Range,Accept-Encoding,Referer,Cache-Control";
        add_header Access-Control-Expose-Headers "Server,Content-Length,Content-Range,Date";
        add_header Access-Control-Allow-Methods "GET, HEAD, OPTIONS";
        add_header Access-Control-Allow-Origin "*";

    }

}

# HTTPS server
#

server {
    listen 443 ssl;
    server_name www.s1.test1.com s1.test1.com;      

    # vod status page
    location = /vod_status {
        vod_status;
        access_log off;
    }

    # redirect server error pages to the static page /50x.html
    error_page 500 502 503 504 /50x.html;

    location = /50x.html {
        root   html;
    }

    vod_secret_key "*************************************$vod_filepath";
    vod_hls_encryption_method aes-128;

    # serve flavor HLS
    location /hls/ {
        vod hls;
        alias /home/;
        vod_segment_duration 5000;
        vod_align_segments_to_key_frames on;

        add_header Access-Control-Allow-Headers "Origin,Range,Accept-Encoding,Referer,Cache-Control";
        add_header Access-Control-Expose-Headers "Server,Content-Length,Content-Range,Date";
        add_header Access-Control-Allow-Methods "GET, HEAD, OPTIONS";
        add_header Access-Control-Allow-Origin "*";

    }

    ssl_certificate /etc/letsencrypt/live/s1.test1.xyz/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/s1.test1.xyz/privkey.pem;
    ssl_trusted_certificate /etc/letsencrypt/live/s1.test1.xyz/chain.pem;
    location ^~ /.well-known/acme-challenge/ {
    allow all;
    root /var/lib/letsencrypt/;
    default_type "text/plain";
    try_files $uri =404;
    }

}

ssl_dhparam /etc/ssl/certs/dhparam.pem;

ssl_session_timeout 1d;
ssl_session_cache shared:SSL:50m;
ssl_session_tickets off;

ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers **************************************************
ssl_prefer_server_ciphers on;

ssl_stapling on;
ssl_stapling_verify on;
resolver 8.8.8.8 8.8.4.4 valid=300s;
resolver_timeout 30s;

add_header Strict-Transport-Security "max-age=15768000; includeSubdomains; preload";
add_header X-Frame-Options SAMEORIGIN;
add_header X-Content-Type-Options nosniff;

}
sambotello commented 4 years ago

I'm having EXACT same issue here, I'm testing on my local network only. When playing on smart tv web browser, it start playing form like a minute or so and then it just stops... I don't know if it kind relates on what it was posted here Video isn't playing in the main domain

I'm really noob on Docker and nginx, so any help will be really appreciate!!