常用的流媒體服務(wù)器有:
nginx、SRS、BMS
這里主要介紹nginx、SRS
這里都用docker來運(yùn)行流媒體服務(wù)器
docker
- 安裝
下載Mac版docker stable 直接安裝
注冊一個(gè)docer賬號直接登錄
SRS
- 安裝
SRS guthub地址:https://github.com/ossrs/srs/
啟動(dòng)上面安裝的docker軟件后,打開終端命令行運(yùn)行以下命令就可以啟動(dòng)SRS:
docker run --rm -p 1935:1935 -p 1985:1985 -p 8080:8080 --restart always \
registry.cn-hangzhou.aliyuncs.com/ossrs/srs:3
iOS端
推流地址設(shè)置為:rtmp://xx.xx.xx.xx/live/livestream(xx.xx.xx.xx為安裝SRS的電腦ip)
WSLiveStreamInfo *stream = [WSLiveStreamInfo new];
stream.url = @"rtmp://xx.xx.xx.xx/live/livestream";
[self.session startLive:stream];
VLC
電腦端使用VLC軟件觀看rtmp直播,VLC下載地址:https://www.videolan.org/vlc/index.html
打開VLC軟件, LIBRARY -> Playlist -> Open media... -> Network -> URL

image.png
nginx
- 安裝
guthub地址:https://registry.hub.docker.com/r/alqutami/rtmp-hls
啟動(dòng)上面安裝的docker軟件后,打開終端命令行運(yùn)行以下命令就可以啟動(dòng)SRS:
docker run -d -p 1935:1935 -p 8080:8080 --restart always alqutami/rtmp-hls
ios推流地址、VLC播放地址為:rtmp://<server ip>:1935/live/<stream_key>
stream_key可以是任何字符串