Update public/script.js
Browse files- 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 |
-
//
|
| 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:
|
| 20 |
-
username: '
|
| 21 |
-
credential: '
|
| 22 |
},
|
| 23 |
{
|
| 24 |
-
urls: 'turn:
|
| 25 |
-
username: '
|
| 26 |
-
credential: '
|
| 27 |
},
|
| 28 |
{
|
| 29 |
-
urls: 'turn:
|
| 30 |
-
username: '
|
| 31 |
-
credential: '
|
| 32 |
}
|
| 33 |
]
|
| 34 |
};
|
|
@@ -140,7 +140,7 @@ function createPeerConnection(targetUserId, isInitiator) {
|
|
| 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') {
|
|
|
|
| 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') {
|