diff --git a/docker-compose.yml b/docker-compose.yml index 08a20c4..0c905ae 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -35,7 +35,6 @@ services: rtmp: build: ./rtmp - container_name: rtmp hostname: rtmp volumes: - "./data/rtmp/hls:/tmp/hls" @@ -50,7 +49,7 @@ services: auth: build: ./auth - container_name: auth_server + hostname: auth networks: internal: {} diff --git a/rtmp/Dockerfile b/rtmp/Dockerfile new file mode 100644 index 0000000..c8ee929 --- /dev/null +++ b/rtmp/Dockerfile @@ -0,0 +1,7 @@ +FROM tiangolo/nginx-rtmp + +COPY nginx.conf /etc/nginx/nginx.conf +COPY index.html /www/ +COPY network.m3u8 +COPY network0.ts +COPY network1.ts diff --git a/rtmp/index.html b/rtmp/index.html new file mode 100644 index 0000000..a9843dc --- /dev/null +++ b/rtmp/index.html @@ -0,0 +1,41 @@ + + + + + + + Live Stream + + +

Live Stream

+ + + + + + + diff --git a/fallback/network.m3u8 b/rtmp/network.m3u8 similarity index 100% rename from fallback/network.m3u8 rename to rtmp/network.m3u8 diff --git a/fallback/network0.ts b/rtmp/network0.ts similarity index 100% rename from fallback/network0.ts rename to rtmp/network0.ts diff --git a/fallback/network1.ts b/rtmp/network1.ts similarity index 100% rename from fallback/network1.ts rename to rtmp/network1.ts diff --git a/rtmp/nginx.conf b/rtmp/nginx.conf new file mode 100644 index 0000000..7e99e61 --- /dev/null +++ b/rtmp/nginx.conf @@ -0,0 +1,40 @@ +events {} +rtmp { + server { + listen 1935; # Listen on standard RTMP port + + application live { + live on; + hls on; + hls_path /tmp/hls; + hls_fragment 10s; # default is 5s + hls_playlist_length 5m; # default is 30s + # once playlist length is reached it deletes the oldest fragments + + # authentication + on_publish http://auth:8000/auth; + } + } +} + +http { + server { + listen 8080; + + location / { + root /www; + } + + location /hls { + types { + application/vnd.apple.mpegurl m3u8; + application/octet-stream ts; + } + root /tmp; + add_header Cache-Control no-cache; + + # To avoid issues with cross-domain HTTP requests (e.g. during development) + add_header Access-Control-Allow-Origin *; + } + } +}