(3) 客户端进行推流,这里的推流软件,我是使用这个 http://www.iavcast.com/html/ruanjian/iavcast.html

(4) 移动端,我使用微信小程序里的 腾讯视频云 这个小程序里面有RTMP测试

(5) nginx-rtmp 日志
1 113.74.127.195 [05/Aug/2018:16:18:08 +0800] PUBLISH "rtmp" "room" "" - 2646572 687 "" "FMLE/3.0 (compatible; FMSc/1.0)" (1m 46s) 2 113.74.127.195 [05/Aug/2018:16:19:49 +0800] PLAY "rtmp" "room" "pass=12345" - 413 542 "" "" (4s) 3 113.74.127.195 [05/Aug/2018:16:19:57 +0800] PLAY "rtmp" "room" "pass=12345" - 413 542 "" "" (4s) 4 113.74.127.195 [05/Aug/2018:16:20:05 +0800] PLAY "rtmp" "room" "pass=12345" - 413 542 "" "" (4s) 5 113.74.127.195 [05/Aug/2018:16:20:13 +0800] PLAY "rtmp" "room" "pass=12345" - 413 542 "" "" (4s) 6 113.74.127.195 [05/Aug/2018:16:30:39 +0800] PLAY "rtmp" "room" "pass=12345" - 413 871 "" "" (4s) 7 113.74.127.195 [05/Aug/2018:16:30:54 +0800] PLAY "rtmp" "room" "pass=12345" - 413 647163 "" "" (12s) 8 113.74.127.195 [05/Aug/2018:16:31:08 +0800] PUBLISH "rtmp" "room" "" - 4961955 409 "" "FMLE/3.0 (compatible; FMSc/1.0)" (1m 30s) 9 113.74.127.195 [05/Aug/2018:23:06:47 +0800] PUBLISH "rtmp" "room" "" - 425763 529 "" "FMLE/3.0 (compatible; FMSc/1.0)" (13s) 10 113.74.127.195 [05/Aug/2018:23:08:29 +0800] PLAY "rtmp" "room" "pass=12345" - 413 871 "" "" (4s) 11 113.74.127.195 [05/Aug/2018:23:08:37 +0800] PLAY "rtmp" "room" "pass=12345" - 413 871 "" "" (4s) 12 113.74.127.195 [05/Aug/2018:23:08:45 +0800] PLAY "rtmp" "room" "pass=12345" - 413 871 "" "" (4s) 13 113.74.127.195 [05/Aug/2018:23:09:05 +0800] PLAY "rtmp" "room" "pass=12345" - 413 926026 "" "" (17s) 14 113.74.127.195 [05/Aug/2018:23:09:30 +0800] PUBLISH "rtmp" "room" "" - 7061016 409 "" "FMLE/3.0 (compatible; FMSc/1.0)" (2m 20s)
5. RTMP鉴权方式
一般商用的话,为了防止被其他人使用和安全性考虑,所以需要对RTMP进行鉴权处理。鉴权如果有特殊性的,可以通过修改nginx-rtmp-module的源代码,然后进行修改,其实就是增加个auth函数,这个函数可以查询数据库之类的,然后决定返回0成功还是-1表示失败。
除了上面说到的方式,还可以通过简单的方式,就是上面提到的HTTP回调。如果HTTP回调返回的HTTP状态码是2xx的,表示成功。如果是返回5xx的状态码,那么表示失败。那样的话,服务器就是断开RTMP连接。
就是在 rtmp://rtmp.wunaozai.com/rtmp_live/room?username=username&password=password
至于实现,这里暂时还没有,其实就是在SpringBoot项目中对每个请求,判断一下参数即可。如果后面有机会就详细写一下,关联Redis数据库,实现房间号功能。但是可能不会写了,因为实际上不难。就是整个流程跑通还是比较多代码要写的,在博客里贴太多代码有点不好。博客最主要的还是提供思路。实际实现就应该在项目中实现了。








