arut / nginx-rtmp-module

NGINX-based Media Streaming Server
http://nginx-rtmp.blogspot.com
BSD 2-Clause "Simplified" License
13.35k stars 3.51k forks source link

HLS sometimes freeze screen. (no .ts file download) #965

Open allostue opened 7 years ago

allostue commented 7 years ago
# RTMP configuration
rtmp {
    server {
        listen 1935; # Listen on standard RTMP port
        chunk_size 4000;

        application live {
            allow publish all;
            deny publish all;
            allow play all;

            # Authentification
            on_publish http://localhost/auth.php;
            notify_method get;

            live on;
            record off;

            # Turn on HLS
            hls on;
            hls_path /mnt/hls/live;
            hls_fragment 2s;
            hls_playlist_length 6s;
            hls_continuous on;
        }
}
# HTTP Configuration
server {
    # live stream
    location /live {
        # Disable cache
        add_header Cache-Control no-cache;

        # CORS setup
        add_header 'Access-Control-Allow-Origin' '*' always;
        add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range';
        add_header 'Access-Control-Allow-Headers' 'Range';

        # allow CORS preflight requests
        if ($request_method = 'OPTIONS') {
            add_header 'Access-Control-Allow-Origin' '*';
            add_header 'Access-Control-Allow-Headers' 'Range';
            add_header 'Access-Control-Max-Age' 1728000;
            add_header 'Content-Type' 'text/plain charset=UTF-8';
            add_header 'Content-Length' 0;
            return 204;
        }

        types {
            video/mp4 mp4;
            application/vnd.apple.mpegurl m3u8;
            video/mp2t ts;
        }

        alias /mnt/hls/live;
        expires -1;
    }
}

When i start streaming look good everything. But sometimes web player stop screen (like a snap image). Network packet was called .m3u8 only when stopped screen. .ts files not called. Refresh chrome or player then download .ts again.

here is my m3u8

EXTM3U

EXT-X-VERSION:3

EXT-X-MEDIA-SEQUENCE:33130

EXT-X-TARGETDURATION:2

EXTINF:2.000,

stream-33130.ts

EXTINF:2.000,

stream-33131.ts

EXTINF:2.000,

stream-33132.ts

Stream client program : Xsplit 2.9.x Web browser : Chrome (any version same problem) Streaming player : jwplayer edge version Stream server : Ubuntu 16.04 / nginx-rtmp-module 1.1.4 / nginx 1.11.9 Host server : Amazon EC2 m4.large + Cloudfront all edge

Is this problem is CDN or server cache? or network? or nginx settings? I don't have any idea. This problem occurred randomize pc and time. (sometime hls 10hours no problem. but sometime stopped 2~3 times per hour) If someone have expierence this problem please help me.

top4music commented 3 years ago

Same here...