我的原始信息流名称为7a0938b1a5e64c5597f959610cb219c9
。我想在调用testchannel1
后将我的信息流名称更改为on_publish
。但在hls_path
中,信息名称仍然与以前相同。如何更改配置文件以实现它。
nginx配置文件
application myapp {
on_publish http://192.168.50.98:8080/auth/on_publish;
on_publish_done http://192.168.50.98:8080/auth/live/on_connect;
live on;
hls on;
hls_path /usr/share/nginx/html/live;
hls_nested on;
hls_fragment 2s;
hls_playlist_length 6s;
hls_fragment_naming system;
}
HTTP请求参数
app: myapp
flashver: FMLE/3.0 (compatible; FMSc/1.0)
swfurl: rtmp://vm1.mysite.com/myapp
tcurl: rtmp://vm1.mysite.com/myapp
pageurl:
addr: 192.168.50.98
clientid: 7
call: publish
name: 7a0938b1a5e64c5597f959610cb219c9
type: live
HTTP响应标题
HTTP/1.1 302
Location: testchannel1
Content-Length: 0
Date: Sun, 23 Apr 2017 05:54:23 GMT
hls路径
[root@localhost live]# pwd
/usr/share/nginx/html/live
[root@localhost live]# ls
7a0938b1a5e64c5597f959610cb219c9 nginx_error.log test.html
nginx版本
nginx version: nginx/1.11.5
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-4) (GCC)
built with OpenSSL 1.0.1e-fips 11 Feb 2013
TLS SNI support enabled
configure arguments: --prefix=/usr/share/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --http-client-body-temp-path=/var/lib/nginx/tmp/client_body --http-proxy-temp-path=/var/lib/nginx/tmp/proxy --http-fastcgi-temp-path=/var/lib/nginx/tmp/fastcgi --http-uwsgi-temp-path=/var/lib/nginx/tmp/uwsgi --http-scgi-temp-path=/var/lib/nginx/tmp/scgi --pid-path=/run/nginx.pid --lock-path=/run/lock/subsys/nginx --user=nginx --group=nginx --with-file-aio --with-ipv6 --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-http_addition_module --with-http_xslt_module=dynamic --with-http_image_filter_module=dynamic --with-http_geoip_module=dynamic --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_degradation_module --with-http_slice_module --with-http_stub_status_module --with-http_perl_module=dynamic --with-mail=dynamic --with-mail_ssl_module --with-pcre --with-pcre-jit --with-stream=dynamic --with-stream_ssl_module --with-google_perftools_module --with-debug --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic' --with-ld-opt='-Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -Wl,-E' --add-module=../nginx-rtmp-module-1.1.10 --with-http_auth_request_module
nginx-rtmp-module版本
nginx-rtmp-module-1.1.10
答案 0 :(得分:2)
Nginx-RTMP模块支持使用通常的HTTP重定向301或302(渗透或临时)的on_publish回调URL,用于将流重定向到另一个。 (请注意,它仅适用于对rtmp服务器而非hls的请求,因为它由http服务器处理)
例如在一个简单的烧瓶应用
中from flask import Flask, redirect
app = Flask('Hello')
@app.route('/publish-check')
def publish_check():
return redirect('rtmp://127.0.0.1/hls-live/testchannel1', code=302)
HTTP/1.1 302
Location: rtmp://127.0.0.1/hls-live/testchannel1
application myapp {
on_publish http://vm1.mysite.com/auth/on_publish;
on_publish_done http://vm1.mysite.com/auth/live/on_connect;
live on;
# hls on;
# hls_path /usr/share/nginx/html/live;
# hls_nested on;
# hls_fragment 2s;
# hls_playlist_length 6s;
# hls_fragment_naming system;
}
application hls-live {
#on_publish http://vm1.chenshenglong.com;
live on;
hls on;
hls_path /usr/share/nginx/html/live;
hls_nested on;
hls_fragment 2s;
hls_playlist_length 6s;
hls_fragment_naming system;
}