48 lines
1.2 KiB
Plaintext
48 lines
1.2 KiB
Plaintext
worker_processes auto;
|
|
events {
|
|
worker_connections 1024;
|
|
}
|
|
|
|
rtmp {
|
|
server {
|
|
listen 1935;
|
|
chunk_size 4096;
|
|
|
|
application live {
|
|
live on;
|
|
record off;
|
|
|
|
allow publish all;
|
|
allow play all;
|
|
|
|
hls on;
|
|
hls_nested on;
|
|
hls_path /stream;
|
|
hls_fragment_naming system;
|
|
hls_fragment 3;
|
|
hls_playlist_length ${STREAM_RING_LENGTH_SECOND};
|
|
|
|
on_publish ${WEB_SERVER_URL}/api/v1/stream/start;
|
|
on_publish_done ${WEB_SERVER_URL}/api/v1/stream/stop;
|
|
on_update ${WEB_SERVER_URL}/api/v1/stream/heartbeat;
|
|
notify_update_timeout 30s;
|
|
}
|
|
}
|
|
}
|
|
|
|
# Serve the HLS segments over HTTP
|
|
http {
|
|
server {
|
|
listen 8088;
|
|
|
|
location /hls {
|
|
types {
|
|
application/vnd.apple.mpegurl m3u8; # proper MIME for HLS playlists
|
|
video/mp2t ts; # MPEG-TS segment MIME
|
|
}
|
|
root /stream;
|
|
add_header Cache-Control no-cache; # prevent stale segments
|
|
add_header Access-Control-Allow-Origin *; # CORS for browser playback
|
|
}
|
|
}
|
|
} |