123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162 |
- # wraps around the static image to deliver HLS video streaming
- http {
- upstream ispooge_static {
- #server ispooge-static:9090;
- server 192.168.1.6:3000;
- }
- types {
- application/vnd.apple.mpegurl m3u8;
- video/mp2t ts;
- }
- server {
- listen 1936;
- listen [::]:1936 ipv6only=on;
- set $cors '';
- if ($http_origin ~ '^https?\:\/\/(localhost(\:[\d+])?|\d+\.\d+\.\d+.\d+|(www\.)?ispooge\.com|(www\.)?harlanji\.com|(www\.)?tinydatacenter\.com)\/?') {
- set $cors 'C';
- }
- set $cors_opts '';
- if ($request_method = 'OPTIONS') {
- set $cors_opts "${cors}O";
- }
- location /hls/ {
- rewrite ^/hls/(.*) /$1 break;
- if ($cors = 'C') {
- add_header 'Access-Control-Allow-Origin' "$http_origin" always;
- add_header 'Access-Control-Allow-Credentials' 'true' always;
- add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS' always;
- add_header 'Access-Control-Allow-Headers' 'Accept,Authorization,Cache-Control,Content-Type,DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent,X-Requested-With' always;
- # required to be able to read Authorization header in frontend
- #add_header 'Access-Control-Expose-Headers' 'Authorization' always;
- }
- if ($cors_opts = 'CO') {
- add_header 'Access-Control-Max-Age' 60;
- add_header 'Content-Type' 'text/plain charset=UTF-8';
- add_header 'Content-Length' 0;
- return 204;
- }
- root /tmp/hls/ispooge.com/;
- }
- # This URL provides RTMP statistics in XML
- location /hls/stat {
- rtmp_stat all;
- # Use this stylesheet to view XML as web page
- # in browser
- rtmp_stat_stylesheet stat.xsl;
- }
- location / {
- if ($cors = 'C') {
- add_header 'Access-Control-Allow-Origin' "$http_origin" always;
- add_header 'Access-Control-Allow-Credentials' 'true' always;
- add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS' always;
- add_header 'Access-Control-Allow-Headers' 'Accept,Authorization,Cache-Control,Content-Type,DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent,X-Requested-With' always;
- # required to be able to read Authorization header in frontend
- #add_header 'Access-Control-Expose-Headers' 'Authorization' always;
- }
- if ($cors_opts = 'CO') {
- add_header 'Access-Control-Max-Age' 60;
- add_header 'Content-Type' 'text/plain charset=UTF-8';
- add_header 'Content-Length' 0;
- return 204;
- }
- proxy_pass http://ispooge_static/;
- }
- }
- }
- worker_processes auto;
- rtmp_auto_push on;
- events {}
- rtmp {
- server {
- listen 1935;
- listen [::]:1935 ipv6only=on;
- chunk_size 4096;
- application participant {
- live on;
- }
- # monitor rtmp
- application record {
- live on;
- record all;
- record_path /tmp/rec;
- record_suffix _%Y-%m-%d_%H-%M-%S.flv;
- record_lock on;
- }
- application hls {
- live on;
- hls on;
- hls_path /tmp/hls/ispooge.com;
- #hls_base_url http://192.168.1.8:33080/hls/;
- hls_fragment 500ms;
- hls_playlist_length 3s;
- hls_fragment_naming_granularity 500;
- hls_continuous on;
- hls_nested on;
- hls_cleanup off;
- hls_fragment_naming system;
- hls_fragment_slicing aligned;
- hls_type live;
- hls_variant _720 BANDWIDTH=6491456 RESOLUTIO=1280x720;
- hls_variant _360 BANDWIDTH=3345728 RESOLUTION=640x360;
- hls_variant _240 BANDWIDTH=1248576 RESOLUTION=416x240;
- }
- application ispoogedaily_local {
- live on;
- push rtmp://127.0.0.1 app=hls live=1;
- }
- application ispoogedaily_source {
- live on;
- }
- application ispoogedaily_live {
- live on;
- #play_restart on;
- drop_idle_publisher 15s;
- #publish_notify on;
- wait_key on;
- wait_video on;
- # interleave on;
- #meta copy;
- # YT LIVE
- #push rtmp://a.rtmp.youtube.com app=live2 playpath=YT_KEY live=1;
- # Twitch
- #push rtmp://live-sjc.twitch.tv app=app playpath=TWITCH_KEY live=1;
- }
- }
- }
|