From 097d4b8b93357ec8b7ce648975411ba4a6eb99e2 Mon Sep 17 00:00:00 2001 From: Alexandre Iooss Date: Wed, 26 Aug 2020 16:24:01 +0200 Subject: [PATCH] Better streaming, less latency and nicer page --- roles/nginx-rtmp/templates/index.html | 6 +++-- .../nginx/modules-available/60-rtmp.conf.j2 | 26 ++++++++++--------- .../templates/nginx/sites-available/stream.j2 | 4 ++- roles/nginx-rtmp/templates/rtmp.conf.j2 | 11 -------- 4 files changed, 21 insertions(+), 26 deletions(-) delete mode 100644 roles/nginx-rtmp/templates/rtmp.conf.j2 diff --git a/roles/nginx-rtmp/templates/index.html b/roles/nginx-rtmp/templates/index.html index 36134d85..45e5839c 100644 --- a/roles/nginx-rtmp/templates/index.html +++ b/roles/nginx-rtmp/templates/index.html @@ -8,7 +8,7 @@
- +
@@ -18,7 +18,9 @@ controls: true, autoplay: true, preload: 'auto', - muted: true + muted: true, + fluid: true, + aspectRatio: '16:9' }).src({ type: 'application/x-mpegURL', src: `/hls/${videoId}.m3u8` diff --git a/roles/nginx-rtmp/templates/nginx/modules-available/60-rtmp.conf.j2 b/roles/nginx-rtmp/templates/nginx/modules-available/60-rtmp.conf.j2 index dda34d59..e780fb6c 100644 --- a/roles/nginx-rtmp/templates/nginx/modules-available/60-rtmp.conf.j2 +++ b/roles/nginx-rtmp/templates/nginx/modules-available/60-rtmp.conf.j2 @@ -1,16 +1,18 @@ -rtmp { - server { - listen 1935; - chunk_size 4096; - application live { - live on; - hls on; - hls_path /var/www/stream/hls/; - hls_fragment 3; - hls_playlist_length 60; +{{ ansible_header | comment }} - record off; +rtmp { + server { + listen 1935; + chunk_size 4096; + application live { + live on; + hls on; + hls_path /var/www/stream/hls/; + hls_fragment 3; + hls_playlist_length 20; + + record off; + } } - } } diff --git a/roles/nginx-rtmp/templates/nginx/sites-available/stream.j2 b/roles/nginx-rtmp/templates/nginx/sites-available/stream.j2 index 9fa05998..2a074c8d 100644 --- a/roles/nginx-rtmp/templates/nginx/sites-available/stream.j2 +++ b/roles/nginx-rtmp/templates/nginx/sites-available/stream.j2 @@ -1,6 +1,8 @@ +{{ ansible_header | comment }} + server { listen 80; - listen [::]:80; + listen [::]:80; server_name {{ nginx_rtmp.uri }}; diff --git a/roles/nginx-rtmp/templates/rtmp.conf.j2 b/roles/nginx-rtmp/templates/rtmp.conf.j2 deleted file mode 100644 index f6a926f7..00000000 --- a/roles/nginx-rtmp/templates/rtmp.conf.j2 +++ /dev/null @@ -1,11 +0,0 @@ -rtmp { - server { - listen 1935; - chunk_size 4096; - application live { - live on; - record off; - } - } -} -