vish85521 commited on
Commit
cabf7d8
·
verified ·
1 Parent(s): 71064ed

Update public/script.js

Browse files
Files changed (1) hide show
  1. public/script.js +11 -11
public/script.js CHANGED
@@ -10,25 +10,25 @@ let localStream;
10
  const peers = {}; // Store connections to other users
11
 
12
  // --- WebRTC Configuration ---
13
- // Includes Google STUN servers and the Metered.ca public TURN fallback
14
  const rtcConfig = {
15
  iceServers: [
16
  { urls: 'stun:stun.l.google.com:19302' },
17
  { urls: 'stun:stun1.l.google.com:19302' }, // Backup STUN
18
  {
19
- urls: 'turn:openrelay.metered.ca:80',
20
- username: 'openrelayproject',
21
- credential: 'openrelayproject'
22
  },
23
  {
24
- urls: 'turn:openrelay.metered.ca:443',
25
- username: 'openrelayproject',
26
- credential: 'openrelayproject'
27
  },
28
  {
29
- urls: 'turn:openrelay.metered.ca:443?transport=tcp',
30
- username: 'openrelayproject',
31
- credential: 'openrelayproject'
32
  }
33
  ]
34
  };
@@ -140,7 +140,7 @@ function createPeerConnection(targetUserId, isInitiator) {
140
  }
141
  };
142
 
143
- // TRACK THE CONNECTION STATUS (Crucial for debugging NAT/Firewall issues)
144
  peer.oniceconnectionstatechange = () => {
145
  console.log(`Connection state with ${targetUserId}:`, peer.iceConnectionState);
146
  if (peer.iceConnectionState === 'failed') {
 
10
  const peers = {}; // Store connections to other users
11
 
12
  // --- WebRTC Configuration ---
13
+ // Using Google STUN and your dedicated Metered.live TURN server
14
  const rtcConfig = {
15
  iceServers: [
16
  { urls: 'stun:stun.l.google.com:19302' },
17
  { urls: 'stun:stun1.l.google.com:19302' }, // Backup STUN
18
  {
19
+ urls: 'turn:saman.metered.live:80',
20
+ username: '1bb6c42832c6a26b4db391e4',
21
+ credential: 'axHWrYuQbsBaG5u9'
22
  },
23
  {
24
+ urls: 'turn:saman.metered.live:443',
25
+ username: '1bb6c42832c6a26b4db391e4',
26
+ credential: 'axHWrYuQbsBaG5u9'
27
  },
28
  {
29
+ urls: 'turn:saman.metered.live:443?transport=tcp',
30
+ username: '1bb6c42832c6a26b4db391e4',
31
+ credential: 'axHWrYuQbsBaG5u9'
32
  }
33
  ]
34
  };
 
140
  }
141
  };
142
 
143
+ // TRACK THE CONNECTION STATUS
144
  peer.oniceconnectionstatechange = () => {
145
  console.log(`Connection state with ${targetUserId}:`, peer.iceConnectionState);
146
  if (peer.iceConnectionState === 'failed') {