HLS stream issue

JohnSmithers nginx-forum at forum.nginx.org
Wed Jun 17 08:26:20 UTC 2020


QUESTION: What steps do I need to take to ensure .m3u8 will appear on
JWPlayer?

Details:

1. I have set up nginx-rtmp module with the current latest version
following
https://docs.peer5.com/guides/setting-up-hls-live-streaming-server-using-nginx/

2. I have connected successfully to the server and nginx was receiving a
stream and successfully restreaming via hls. I received the .m3u8 restream
on my browser. 

3. I left it for one week. When I returned I found I could not longer
receive .m3u8 streams.

4. I have tried many different pathways of installation but the most
successful is still the one I followed above. Every new installation attempt
falls at the hls stream pushing from the server.

5. JW Player supplies error code 232011 - Cannot load M3U8: Crossdomain
access denied

6. Output from nginx hls (proving rtmp stream being received and
converted):
total 12812
drwxr-xr-x 2 nobody   www-data    4096 Jun 16 16:04 .
drwxr-xr-x 3 www-data www-data    4096 Jun 16 15:58 ..
-rw-r--r-- 1 nobody   nogroup   837916 Jun 16 16:02 test-0.ts
-rw-r--r-- 1 nobody   nogroup   835848 Jun 16 16:02 test-1.ts
-rw-r--r-- 1 nobody   nogroup  1007116 Jun 16 16:04 test-10.ts
-rw-r--r-- 1 nobody   nogroup  1012380 Jun 16 16:04 test-11.ts
-rw-r--r-- 1 nobody   nogroup  1004860 Jun 16 16:04 test-12.ts
-rw-r--r-- 1 nobody   nogroup  1013508 Jun 16 16:04 test-13.ts
-rw-r--r-- 1 nobody   nogroup   242896 Jun 16 16:04 test-14.ts
-rw-r--r-- 1 nobody   nogroup   850512 Jun 16 16:03 test-2.ts
-rw-r--r-- 1 nobody   nogroup   826636 Jun 16 16:03 test-3.ts
-rw-r--r-- 1 nobody   nogroup   849948 Jun 16 16:03 test-4.ts
-rw-r--r-- 1 nobody   nogroup   830208 Jun 16 16:03 test-5.ts
-rw-r--r-- 1 nobody   nogroup   837540 Jun 16 16:03 test-6.ts
-rw-r--r-- 1 nobody   nogroup   902588 Jun 16 16:03 test-7.ts
-rw-r--r-- 1 nobody   nogroup  1011440 Jun 16 16:03 test-8.ts
-rw-r--r-- 1 nobody   nogroup  1012756 Jun 16 16:04 test-9.ts
-rw-r--r-- 1 nobody   nogroup      448 Jun 16 16:04 test.m3u8

7. Configuration file:

++++++++++++++

worker_processes  auto;
events {
    worker_connections  1024;
}

# RTMP configuration
rtmp {
    server {
        listen 1935; # Listen on standard RTMP port
        chunk_size 4000;

        application show {
            live on;
            # Turn on HLS
            hls on;
            hls_path /nginx/hls/;
            hls_fragment 3;
            hls_playlist_length 60;
            # disable consuming the stream from nginx as rtmp
            deny play all;
        }
    }
}

http {
    sendfile off;
    tcp_nopush on;
    # aio on;
    directio 512;
    default_type application/octet-stream;

    server {
        listen 8080;

        location / {
            # 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';

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

            types {
                application/dash+xml mpd;
                application/vnd.apple.mpegurl m3u8;
                video/mp2t ts;
            }

            root /nginx/;
        }
    }
}

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,288371,288371#msg-288371



More information about the nginx mailing list