UPDATE: Change to how streams are accessed, detected and published to the application

This commit is contained in:
Chris-1010
2025-02-22 12:05:20 +00:00
parent 3b65bc87ae
commit 9cc5b40b25
3 changed files with 105 additions and 71 deletions

View File

@@ -1,4 +1,5 @@
worker_processes 1;
error_log /var/log/nginx/error.log warn;
events {
worker_connections 1024;
@@ -15,8 +16,8 @@ rtmp {
deny play all;
push rtmp://127.0.0.1:1935/hls-live;
on_publish http://web_server:5000/publish_stream;
on_publish_done http://web_server:5000/end_stream;
on_publish http://web_server:5000/init_stream; # if the stream is detected from OBS
on_publish_done http://web_server:5000/end_stream; # if the stream is ended on OBS
}
@@ -24,7 +25,7 @@ rtmp {
live on;
hls on;
hls_path /stream_data/;
hls_path /stream_data/stream/;
allow publish 127.0.0.1;
deny publish all;
@@ -78,7 +79,7 @@ http {
# The MPEG-TS video chunks are stored in /tmp/hls
location ~ ^/stream/(.+)/(.+\.ts)$ {
alias /stream_data/$1/stream/$2;
alias /stream_data/stream/$1/$2;
# Let the MPEG-TS video chunks be cacheable
expires max;
@@ -86,35 +87,36 @@ http {
# The M3U8 playlists location
location ~ ^/stream/(.+)/(.+\.m3u8)$ {
alias /stream_data/$1/stream/$2;
alias /stream_data/stream/$1/$2;
# The M3U8 playlists should not be cacheable
expires -1d;
}
#! Unused right now so the following are inaccurate locations
# The thumbnails location
location ~ ^/stream/(.+)/thumbnails/(.+\.jpg)$ {
alias /stream_data/$1/thumbnails/$2;
# location ~ ^/stream/(.+)/thumbnails/(.+\.jpg)$ {
# alias /stream_data/$1/thumbnails/$2;
# The thumbnails should not be cacheable
expires -1d;
}
# # The thumbnails should not be cacheable
# expires -1d;
# }
# The vods location
location ~ ^/stream/(.+)/vods/(.+\.mp4)$ {
alias /stream_data/$1/vods/$2;
# # The vods location
# location ~ ^/stream/(.+)/vods/(.+\.mp4)$ {
# alias /stream_data/$1/vods/$2;
# The vods should not be cacheable
expires -1d;
}
# # The vods should not be cacheable
# expires -1d;
# }
location ~ ^/\?token=.*$ {
proxy_pass http://frontend:5173;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
}
# location ~ ^/\?token=.*$ {
# proxy_pass http://frontend:5173;
# proxy_http_version 1.1;
# proxy_set_header Upgrade $http_upgrade;
# proxy_set_header Connection "upgrade";
# proxy_set_header Host $host;
# }
location / {
proxy_pass http://frontend:5173;