We tested:
configure
and make
;listen 1935; max_connections 1000; daemon off; srs_log_tank console; vhost __defaultVhost__ { hls { enabled on; hls_fragment 10; hls_window 30; hls_path /var/www/html hls_m3u8_file [app]/[stream].m3u8; hls_ts_file [app]/[stream]-[seq].ts; } }
.objs/srs -c myconf.conf
/etc/nginx/nginx.conf
user www-data; worker_processes auto; pid /run/nginx.pid; include /etc/nginx/modules-enabled/*.conf; events { worker_connections 768; } rtmp { server { listen 1935; # Listen on standard RTMP port chunk_size 4000; notify_method get; application live { on_publish http://localhost/auth.php; record off; live on; hls on; hls_path /var/www/streams; hls_fragment 10s; hls_playlist_length 20s; allow play all; } } } http { sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; types_hash_max_size 2048; include /etc/nginx/mime.types; default_type application/octet-stream; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE ssl_prefer_server_ciphers on; access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log; gzip on; include /etc/nginx/conf.d/*.conf; include /etc/nginx/sites-enabled/*; }
/etc/nginx/sites-available/default
server { listen 80 default_server; listen [::]:80 default_server; server_name soergel.xgelb; root /var/www/html; index index.html index.htm index.nginx-debian.html; location / { try_files $uri $uri/ =404; } location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/run/php/php7.3-fpm.sock; } location /live { types { application/vnd.apple.mpegurl m3u8; } alias /var/www/streams; add_header Cache-Control no-cache; } }
snippets/fastcgi-php.conf
fastcgi_split_path_info ^(.+?\.php)(/.*)$; try_files $fastcgi_script_name =404; set $path_info $fastcgi_path_info; fastcgi_param PATH_INFO $path_info; fastcgi_index index.php; include fastcgi.conf;
auth.php
<?php if(empty($_GET['user']) || empty($_GET['key'])) { echo "wrong query input"; header('HTTP/1.0 404 Not Found'); exit(1); } else { $thisuser = $_GET['user']; $thiskey = $_GET['key']; } $saveduser = user ; $savedkey = passwd ; //check pass and user string if (strcmp($thiskey,$savedkey)==0 && strcmp($thisuser,$saveduser)==0 ) { echo "Username and Key OK! "; } else { echo "username or key wrong! "; header('HTTP/1.0 404 Not Found'); } ?>
video.js
video.js
from https://github.com/videojs/video.js/releases/download/v7.6.5/video-js-7.6.5.zip
to /var/www/html/
/var/www/html/
, run unzip video-js-7.6.5.zip
and remove zip-file rm video-js-7.6.5.zip
<!doctype html> <html lang="de"> <head> <meta charset=utf-8 /> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>WTH/S in Chemnitz</title> <link href="/video-js.css" rel="stylesheet"> <script src="/video.js"></script> <script src="/videojs-contrib-hls.js"></script> <script> var player = videojs('example-video'); player.play(); </script> <style> body { text-align: center; color: black; background-color:white; font-family: sans-serif; font-size: 16pt; } p { padding-top : 150px; } a:link { color:black; text-decoration: none; } a:visited { color:black; text-decoration: none; } a:focus { color:black; text-decoration: none; } a:hover { color:black; text-decoration: none; } a:active { color:black; text-decoration: none; } </style> </head> <body> <center> <video poster="nostream.png" id="example-video" class="video-js vjs-default-skin" controls preload="auto" width="1152" height="648" data-setup='{}'> <source src="http://example.de/live/wths.m3u8" type="application/x-mpegURL"> <p class="vjs-no-js">To view this video please enable JavaScript, and consider upgrading to a web browser that <a href="http://videojs.com/html5-video-support/" target="_blank">supports HTML5 video</a></p> </source> </video> <p><a href="https://bbb.example.de">Big Blue Button - E-Lerning Plattform</a></p> </center> </body> </html>
/etc/nginx/nginx.conf
user www-data; worker_processes auto; pid /run/nginx.pid; include /etc/nginx/modules-enabled/*.conf; events { worker_connections 768; } rtmp { server { listen 1935; # Listen on standard RTMP port chunk_size 256; buflen 200ms; notify_method get; application live { on_publish http://localhost:8080/auth; #on_play http://localhost:8080/auth; record off; live on; hls on; hls_path /var/www/streams; hls_fragment 10s; hls_playlist_length 20s; allow play all; } } } http { sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; types_hash_max_size 2048; include /etc/nginx/mime.types; default_type application/octet-stream; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE ssl_prefer_server_ciphers on; access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log; gzip on; include /etc/nginx/conf.d/*.conf; include /etc/nginx/sites-enabled/*; }
/etc/nginx/sites-available/default
server { listen 8080; location /auth {} if ($arg_psk = 'password') { return 201; } return 404; }