我遵循了这个例子:https://github.com/pion/example-webrtc-applications/tree/master/sfu-ws
在本地正在工作
我做了一个linux版本,我把它放在服务器上,正在工作
我把它放在一个码头集装箱里,它不再工作了。
在泊坞服务器上,我打开了端口范围:
50000-50200:50000-50200/udp
version: '3'
services:
app:
image: xxxx
container_name: web_preprod
ports:
- 127.0.0.1:8080:8080
- 127.0.0.1:6060:6060
- 50000-50200:50000-50200/udp
restart: on-failure
networks:
- xxxx
nginx:
image: nginx:latest
restart: always
container_name: nginx_preprod
command: "/bin/sh -c 'while :; do sleep 6h & wait $${!}; nginx -s reload; done & nginx -g \"daemon off;\"'"
ports:
- "80:80"
- "443:443"
- "6061:6061"
- "6062:6062"
networks:
- xxxx
volumes:
- /tmp:/tmp
- ./nginx.conf:/etc/nginx/nginx.conf
- ./data/certbot/conf:/etc/letsencrypt
- ./data/certbot/www:/var/www/certbot
depends_on:
- app
networks:
xxxx:
driver: bridge
端口不安全,用于测试。6061
在我的服务器上,我放置了要使用的相同端口:
se := webrtc.SettingEngine{}
se.SetEphemeralUDPPortRange(50000, 50200)
WebRTCApi = webrtc.NewAPI(webrtc.WithMediaEngine(getPublisherMediaEngine()), webrtc.WithSettingEngine(se))
但我在服务器或客户端上都没有得到。我看到了什么,在服务器上我收到了onTrack
PeerConnectionStateFailed
我使用谷歌眩晕,和客户端上的免费服务器
var config = {
iceServers: [{
urls: ["stun:stun1.l.google.com:19302"]
},
{
urls: 'turn:numb.viagenie.ca:3478',
credential: 'xxxx',
username: 'xxxx@gmail.com'
}
]
};
pc = new RTCPeerConnection(config)
如果你有任何想法,我会欣赏。
江户川乱折腾
蝴蝶刀刀
随时随地看视频慕课网APP
相关分类