- Installed
agora-rtc-sdk-ngpackage - Installed
agora-rtc-reactpackage - Installed
agora-access-tokenpackage - Created
hooks/use-agora-rtc.tshook - Created
app/api/agora/token/route.tsAPI route - Updated
components/meeting-live-view.tsxwith Agora integration - Updated
components/meetings-list.tsxto generate channel names
Create a .env.local file in your project root (if it doesn't exist) and add:
# Agora Configuration
NEXT_PUBLIC_AGORA_APP_ID=your_agora_app_id_here
AGORA_APP_ID=your_agora_app_id_here
AGORA_APP_CERTIFICATE=your_agora_app_certificate_hereHow to get these:
- Go to Agora Console
- Sign up/Login
- Create a new project
- Copy the App ID from Project Management
- Generate and copy the App Certificate
After adding environment variables, restart your server:
# Stop the current server (Ctrl+C)
npm run dev-
Navigate to Meetings Page:
- Go to
http://localhost:3000/meetings - Click "Start Meeting" button
- Go to
-
Allow Permissions:
- Browser will prompt for camera/microphone access
- Click "Allow" for both
-
Verify Connection:
- You should see "Connecting..." briefly
- Then your local video should appear
- Timer should start counting
-
Test Controls:
- Click mic button to mute/unmute
- Click video button to turn video on/off
- Click red phone button to leave meeting
To test with multiple participants:
- Open the same meeting URL in another browser/incognito window
- Or share the URL with another person
- Both users should see each other's video
Example URL:
http://localhost:3000/meetings/live?channel=test-meeting-123&title=Test%20Meeting
Issue: "Agora App ID not configured"
- ✅ Check that
.env.localexists - ✅ Verify
NEXT_PUBLIC_AGORA_APP_IDis set - ✅ Restart the dev server after adding env vars
Issue: "Failed to fetch token"
- ✅ Check that
AGORA_APP_CERTIFICATEis set - ✅ Verify API route is working:
http://localhost:3000/api/agora/token?channel=test&uid=123 - ✅ Check browser console for errors
Issue: No video showing
- ✅ Check browser permissions (camera/mic)
- ✅ Verify camera is not being used by another app
- ✅ Check browser console for errors
- ✅ Try refreshing the page
Issue: Can't hear audio
- ✅ Check browser permissions (microphone)
- ✅ Verify system audio is not muted
- ✅ Check browser console for errors
For production:
-
Set Environment Variables:
- Add the same env vars to your hosting platform (Vercel, AWS, etc.)
- Make sure
NEXT_PUBLIC_AGORA_APP_IDis set as a public variable
-
Security:
- Never commit
.env.localto git (already in.gitignore) - Use production App ID and Certificate
- Consider implementing token refresh mechanism
- Never commit
-
Testing:
- Test with multiple users
- Test on different devices/browsers
- Test network conditions
Once you've completed these steps, your Agora video calling integration should be working. The meeting page will automatically:
- Generate tokens
- Join Agora channels
- Display local and remote video
- Handle audio/video controls