Skip to content

Commit

Permalink
Merge pull request #160 from CS3219-AY2425S1/fix/audio-call
Browse files Browse the repository at this point in the history
Test Audio
  • Loading branch information
tyouwei authored Nov 9, 2024
2 parents 7d82477 + b599dfa commit 8531ce6
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions peerprep-fe/src/app/collaboration/components/AudioSharing.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,13 @@ const AudioSharing = () => {
process.env.NEXT_PUBLIC_AUDIO_SERVER_URL || 'http://localhost:5555';

// Add TURN server credentials from environment variables
const TURN_SERVER =
process.env.NEXT_PUBLIC_TURN_SERVER || 'turn:localhost:3478';
const TURN_USERNAME = process.env.NEXT_PUBLIC_TURN_USERNAME || 'username';
const TURN_CREDENTIAL =
process.env.NEXT_PUBLIC_TURN_CREDENTIAL || 'credential';
const TURN_SERVER = process.env.NEXT_PUBLIC_TURN_SERVER;
const TURN_USERNAME = process.env.NEXT_PUBLIC_TURN_USERNAME;
const TURN_CREDENTIAL = process.env.NEXT_PUBLIC_TURN_CREDENTIAL;

if (!TURN_SERVER || !TURN_USERNAME || !TURN_CREDENTIAL) {
console.error('Missing TURN environment variables');
}

const cleanupAudio = () => {
if (audioStreamRef.current) {
Expand Down Expand Up @@ -54,11 +56,11 @@ const AudioSharing = () => {
{ urls: 'stun:stun.l.google.com:19302' },
{ urls: 'stun:global.stun.twilio.com:3478' },
// Add TURN server configuration
{
urls: TURN_SERVER,
username: TURN_USERNAME,
credential: TURN_CREDENTIAL,
},
// {
// urls: TURN_SERVER,
// username: TURN_USERNAME,
// credential: TURN_CREDENTIAL,
// },
],
},
});
Expand Down

0 comments on commit 8531ce6

Please sign in to comment.