srs/trunk/conf/python.conf
Jason-JP-Yang 241a33b7b5 Addition Features: Python Addons
You can now use Python scripts as addons in SRS.
Remark: Only available in Ubuntu Linux x86_64 version.
Not available in other platform (Cgywin64, MacOS_Unix, Docker)

After modification in requirements.txt, please reconfigure the
SRS source code by "./trunk/configure"
2025-05-28 22:20:32 +08:00

67 lines
1.7 KiB
Plaintext

# SRS configuration with Python addons
# This demonstrates how to configure Python addons that start with SRS
# and terminate when SRS gracefully quits.
# The Python addons use SRS's built-in Python environment created during compilation.
listen 1935;
max_connections 1000;
daemon off;
srs_log_tank console;
pid ./objs/srs.python.pid;
# Python addon configuration
python_addons {
# Enable or disable Python addon management
enabled on;
# Python addon definitions
# Each addon block defines a Python script to run
addon {
# Script path relative to SRS working directory
script "./python/monitor.py";
# Command line arguments (optional)
args "--config ./conf/python.conf --verbose";
# Working directory (optional, defaults to SRS working directory)
work_dir "./";
}
addon {
script "./python/analytics.py";
args "--port 8888";
}
addon {
script "./python/http_addon.py";
args "--port 9999 --verbose";
}
}
http_api {
enabled on;
listen 1985;
}
http_server {
enabled on;
listen 8080;
dir ./objs/nginx/html;
}
vhost __defaultVhost__ {
enabled on;
gop_cache on;
hls {
enabled on;
hls_path ./objs/nginx/html;
hls_fragment 5;
hls_window 30;
}
http_hooks {
enabled on;
on_publish http://127.0.0.1:8085/api/v1/streams;
on_unpublish http://127.0.0.1:8085/api/v1/streams;
}
}