| | |
| | | |
| | | function createPC() { |
| | | pc = new RTCPeerConnection({ |
| | | iceServers: [{ urls: 'stun:stun.l.google.com:19302' }], |
| | | iceServers: [{ urls: 'stun:stun.l.google.com:19302' }, |
| | | { urls: 'stun:stun.l.google.com:19302' }, |
| | | { urls: 'stun:stun1.l.google.com:19302' }, |
| | | { urls: 'stun:stun.stunprotocol.org:3478' }, |
| | | // 添加多个公共TURN服务器以提高跨网络连接成功率 |
| | | { urls: ['turn:freeturn.net:80', 'turn:freeturn.net:443'], username: 'free', credential: 'free' }, |
| | | // 备用TURN服务器 |
| | | { urls: 'turn:turn.cloudlifter.io:443', username: 'webrtc', credential: 'webrtc' }], |
| | | }) |
| | | |
| | | pc.onicecandidate = (e) => { |