53 lines
1.1 KiB
Markdown
53 lines
1.1 KiB
Markdown
地址:/opt/live-streaming/docker/srs/srs.conf
|
|
|
|
|
|
|
|
listen 1935;
|
|
max_connections 1000;
|
|
daemon off;
|
|
srs_log_tank console;
|
|
|
|
http_server {
|
|
enabled on;
|
|
listen 8080;
|
|
dir ./objs/nginx/html;
|
|
crossdomain on;
|
|
}
|
|
|
|
http_api {
|
|
enabled on;
|
|
listen 1985;
|
|
crossdomain on;
|
|
}
|
|
|
|
vhost __defaultVhost__ {
|
|
hls {
|
|
enabled on;
|
|
hls_path ./objs/nginx/html;
|
|
hls_fragment 2;
|
|
hls_window 4;
|
|
hls_cleanup on;
|
|
}
|
|
|
|
http_remux {
|
|
enabled on;
|
|
mount [vhost]/[app]/[stream].flv;
|
|
}
|
|
|
|
play {
|
|
gop_cache on;
|
|
queue_length 10;
|
|
mw_latency 100;
|
|
}
|
|
|
|
# 关键:添加 HTTP 回调
|
|
http_hooks {
|
|
enabled on;
|
|
on_publish http://host.docker.internal:8083/api/front/live/srs/on_publish;
|
|
on_unpublish http://host.docker.internal:8083/api/front/live/srs/on_unpublish;
|
|
}
|
|
}
|
|
|
|
|
|
docker exec -it srs-server ln -s /usr/local/srs/objs/nginx/html/__defaultApp__ /usr/local/srs/objs/nginx/html/live
|