【nginx-rtmp】04、获取客户端订阅/连接数(Getting number of subscribers)
来源:互联网 发布:淘宝账号销号 编辑:程序博客网 时间:2024/06/13 08:51
这是一个简单的方法来显示流媒体的观看人数,你需要在 location /stat 里设置统计页面(Set up statistics page at location /stat):
location /stat {
rtmp_stat all;
allow 127.0.0.1;
}
rtmp_stat all;
allow 127.0.0.1;
}
创建一个简单的 xsl 文件 nclients.xsl ,用来提取流媒体订阅数:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html"/>
<xsl:param name="app"/>
<xsl:param name="name"/>
<xsl:template match="/">
<xsl:value-of select="count(//application[name=$app]/live/stream[name=$name]/client[not(publishing) and flashver])"/>
</xsl:template>
</xsl:stylesheet>
<xsl:output method="html"/>
<xsl:param name="app"/>
<xsl:param name="name"/>
<xsl:template match="/">
<xsl:value-of select="count(//application[name=$app]/live/stream[name=$name]/client[not(publishing) and flashver])"/>
</xsl:template>
</xsl:stylesheet>
设置一个location用来返回订阅数:
location /nclients {
proxy_pass http://127.0.0.1/stat;
xslt_stylesheet /www/nclients.xsl app='$arg_app' name='$arg_name';
add_header Refresh "3; $request_uri";
}
proxy_pass http://127.0.0.1/stat;
xslt_stylesheet /www/nclients.xsl app='$arg_app' name='$arg_name';
add_header Refresh "3; $request_uri";
}
使用http请求获取流媒体订阅数:
http://myserver.com/nclients?app=myapp&name=mystream
在浏览器中的上时,会每3秒钟自动刷新!
参考:https://github.com/arut/nginx-rtmp-module/wiki/Getting-number-of-subscribers
阅读全文
0 0
- 【nginx-rtmp】04、获取客户端订阅/连接数(Getting number of subscribers)
- 获取某个端口的tcp连接数(nginx)
- 在windows环境下测试nginx+rtmp流媒体服务器连接数
- 【翻译自mos文章】加大数据库连接数(the Number of Database Connections )
- sybase 15.7 修改 number of user connections 最大连接数
- WordPress 使用 Email Subscribers & Newsletters 添加邮件订阅功能
- 流媒体服务器(Nginx+rtmp)
- nginx限制连接数(ngx_http_limit_conn_module)模块
- Nginx 查看连接数
- nginx 连接数
- Nginx连接数限制
- nginx-rtmp
- nginx rtmp
- nginx+rtmp
- 获取peergroup的所有peers(Getting a list of the peers in a PeerGroup)
- 求逆序数(the number of inversions)(数学)
- LeetCode 191. Number of 1 Bits(比特数)
- nginx获取客户端IP实现
- 相关性学习-皮尔逊相关系数
- Parallel Scavenge收集器
- LFR简单使用入门
- 超强自定义TabLayout
- Codis源码解析——codis-server添加到集群
- 【nginx-rtmp】04、获取客户端订阅/连接数(Getting number of subscribers)
- Mysql 中!=和 <>
- aix下扩充swap大小
- JDNI配置和使用
- poj3259(判断有无负环)
- MVC与三层架构区别
- codeforces822D(思维)
- Android 发送广播
- 深搜广搜