在我看来srs内嵌的http完全可以取代nginx。废话少说,先说如何使用:
编译的时候必须开启相关选项
[root@localhost trunk]# ./configure --disable-all --with-ssl --with-hls --with-nginx --with-ffmpeg --with-transcode --with-http-callback --with-http-api --with-http-server --with-stream-caster --with-librtmp --with-dvr && make
配置:
http_hooks {
# whether the http hooks enalbe.
# default off.
enabled on;
# on_connect http://127.0.0.1:8085/api/v1/clients;
# on_close http://127.0.0.1:8085/live/run_test/close.sh;
# on_publish http://127.0.0.1:8085/live/run_test/publish.sh;
# on_unpublish http://127.0.0.1:8085/live/run_test/unpublish.sh;
# on_play http://127.0.0.1:8085/live/run_test/play.sh;
# on_stop http://127.0.0.1:8085/live/run_test/stop.sh;
}
启动该项服务时,需要开启python进程。
启动方法:python research/api-server/server.py 8085
其实所谓的防盗链,我感觉可以在这个回调里做操作,如屏蔽推流功能、请求播放功能等等。详细修改的位置,按照winlin老大的他意思需要熟悉python,不过像我等屌丝很快就可以上手这种简单语言。
修改research\api-server\server.py :
看到on_connect位置了么?这个code进行自定义后就可以做相关限制了。