Skip to content

Commit c4b68f8

Browse files
committed
Fix Turn Connection
1 parent b599dfa commit c4b68f8

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

peerprep-fe/src/app/collaboration/components/AudioSharing.tsx

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,9 @@ const AudioSharing = () => {
2121
process.env.NEXT_PUBLIC_AUDIO_SERVER_URL || 'http://localhost:5555';
2222

2323
// Add TURN server credentials from environment variables
24-
const TURN_SERVER = process.env.NEXT_PUBLIC_TURN_SERVER;
25-
const TURN_USERNAME = process.env.NEXT_PUBLIC_TURN_USERNAME;
26-
const TURN_CREDENTIAL = process.env.NEXT_PUBLIC_TURN_CREDENTIAL;
27-
28-
if (!TURN_SERVER || !TURN_USERNAME || !TURN_CREDENTIAL) {
29-
console.error('Missing TURN environment variables');
30-
}
24+
const TURN_SERVER = process.env.NEXT_PUBLIC_TURN_SERVER || 'turn:localhost';
25+
const TURN_USERNAME = process.env.NEXT_PUBLIC_TURN_USERNAME || 'none';
26+
const TURN_CREDENTIAL = process.env.NEXT_PUBLIC_TURN_PASSWORD || 'none';
3127

3228
const cleanupAudio = () => {
3329
if (audioStreamRef.current) {
@@ -56,11 +52,11 @@ const AudioSharing = () => {
5652
{ urls: 'stun:stun.l.google.com:19302' },
5753
{ urls: 'stun:global.stun.twilio.com:3478' },
5854
// Add TURN server configuration
59-
// {
60-
// urls: TURN_SERVER,
61-
// username: TURN_USERNAME,
62-
// credential: TURN_CREDENTIAL,
63-
// },
55+
{
56+
urls: TURN_SERVER,
57+
username: TURN_USERNAME,
58+
credential: TURN_CREDENTIAL,
59+
},
6460
],
6561
},
6662
});

0 commit comments

Comments
 (0)