-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
v4_EN_WebRTC
winlin edited this page Jun 20, 2021
·
15 revisions
https://github.com/ossrs/srs/issues/307
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:v4.0.91 \
objs/srs -c conf/rtc.conf
Note:About the usage of srs-docker, please read srs-docker.
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: