# /etc/srs/srs.conf
# Configuration for bridging SRT -> HLS (No WebRTC/Opus)

listen              1935;
max_connections     1000;

daemon              off;

srs_log_tank        file;
srs_log_file        /var/log/srs.log;
srs_log_level       trace;

pid                 /run/srs.pid;

# HTTP API integrated section (for statistics)
http_api {
    enabled         on;
    listen          1985;
}

# Protocollo Ingest SRT
srt_server {
    enabled         on;
    listen          10080; # UDP port for the SRT flow
}

# Live Flow configuration and HLS export
vhost __defaultVhost__ {

    # Enable SRT
    srt {
        enabled         on;
	srt_to_rtmp     on; # Convert SRT to RTMP internally to generare HLS
    }

    # Enabling HLS segment generation for the web server
    hls {
        enabled         on;
        hls_path        /var/spool/srs; # Temporary directory read by the web server
        hls_fragment    2;      # Time in seconds for each .ts fragment
        hls_window      10;     # Number of seconds to keep in the .m3u8 playlist
    }
}
