-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
v4_EN_WebRTC
https://github.com/ossrs/srs/issues/307
There are some config for WebRTC:
- full.conf: Section
rtc_server
and vhostrtc.vhost.srs.com
is about WebRTC. - rtc.conf: WebRTC to WebRTC clients.
- rtmp2rtc.conf: Covert RTMP to WebRTC.
- rtc2rtmp.conf: Covert WebRTC to RTMP.
The play will definitely fail if the CANDIDATE
of config is not correct,
because it's the RTP server address(IP
and port) in SDP, the IP
is CANDIDATE
:
type: answer, sdp: v=0
a=candidate:0 1 udp 2130706431 192.168.3.6 8000 typ host generation 0
So the CANDIDATE
is 192.168.3.6
here, which is the IP of server.
We could config it by:
- Use plaintext IP directly, such as
candidate 192.168.3.6;
- Use command
ifconfig
to retrieve IP of network interface, pass it by ENV, such ascandidate $CANDIDATE;
- Try to read the intranet IP from network interface, for example,
candidate *;
- Read from query string of stream URL, such as
webrtc://192.168.3.6/live/livestream?eip=192.168.3.6
Use command ifconfig
to retrieve the IP:
# For macOS
ifconfig en0 inet| grep 'inet '|awk '{print $2}'
# For CentOS
ifconfig eth0|grep 'inet '|awk '{print $2}'
Pass it to SRS by ENV:
# For macOS
env CANDIDATE=$(ifconfig en0 inet| grep 'inet '|awk '{print $2}') \
./objs/srs -c conf/rtc.conf
For example, to run SRS in docker, and setup the CANDIDATE:
docker run --rm --env CANDIDATE=$(ifconfig en0 inet| grep 'inet '|awk '{print $2}') \
-p 1935:1935 -p 8080:8080 -p 1985:1985 -p 8000:8000/udp \
registry.cn-hangzhou.aliyuncs.com/ossrs/srs:4 \
objs/srs -c conf/rtc.conf
Note:About the usage of srs-docker, please read srs-docker.
Online demo URL:
Please use conf/rtmp2rtc.conf
as config.
Please use conf/rtc.conf
as config.
Please use conf/rtc2rtmp.conf
as config.
Please use conf/rtc.conf
as config.
Please use conf/rtc.conf
as config.
Please use conf/rtc.conf
as config.
Winlin 2020.02
Welcome to SRS wiki!
Please select your language:
Please select your language:
Please select your language:
Please select your language:
Please select your language: