[英]Dynamic hls_path based on stream name in rtmp module with nginx
I use nginx with rtmp module to build live broadcasting application that clients could join it dynamically and I want to do this without reloading nginx. 我将nginx与rtmp模块一起使用,以构建客户端可以动态加入的直播应用程序,而我希望这样做而无需重新加载nginx。
I want to set hls_path
in application directive base on input stream name but I have no idea how to do it. 我想基于输入流名称在应用程序指令中设置
hls_path
,但是我不知道该怎么做。
for example in exec
directive it's possible to reach stream name with $name
variable but it's not valid in hls_path
directive. 例如,在
exec
指令中,可以使用$name
变量访问流名称,但在hls_path
指令中无效。
I test below configuration but nginx created exact $name
directory instead of stream name. 我测试以下配置,但是nginx创建了确切的
$name
目录而不是流名称。
application live {
live on;
record off;
hls on;
hls_path /workspace/$name;
hls_fragment 10s;
}
Just add hls_nested on; 只需添加hls_nested; to your config, this creates a sub directory in hls_path using the stream name.
到您的配置,这将使用流名称在hls_path中创建一个子目录。 Check out the wiki link below.
查看下面的Wiki链接。
https://github.com/arut/nginx-rtmp-module/wiki/Directives#hls_nested https://github.com/arut/nginx-rtmp-module/wiki/Directives#hls_nested
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.