A WebRTC to Discord audio bridge that allows you to stream audio from a web interface directly to a Discord voice channel.
This application creates a bridge between WebRTC audio streams and Discord voice channels. It enables:
- Real-time audio forwarding from a web browser to Discord
- Seamless Opus audio codec compatibility
- Simple web interface for establishing connections
- WebRTC audio capture from browser
- Discord voice channel integration
- Automatic Opus codec handling
- Web-based control interface
- Go 1.16+
- Discord Bot with proper permissions
- STUN server access (defaults to Google's public STUN server)
Create a .env file in the project root with the following variables:
DISCORD_BOT_TOKEN=your_discord_bot_token
DISCORD_GUILD_ID=your_discord_server_id
DISCORD_CHANNEL_ID=your_voice_channel_id
YOUTUBE_API_KEY=your_youtube_api_key (optional)
-
Clone the repository:
git clone https://github.com/yourusername/discord-audio-bridge.git cd discord-audio-bridge -
Install dependencies:
go mod download
-
Build the application:
go build
-
Start the server:
./discord-audio-bridge
-
Open your web browser and navigate to:
http://localhost:8080 -
Grant permissions to capture tab audio in your browser and begin streaming to Discord
The server runs on port 8080 by default and provides:
- Static file serving from the
./staticdirectory - WebRTC signaling via WebSocket at
/rtc - YouTube API key endpoint at
/api/youtube-key(if configured)
- discordgo - Discord API wrapper
- Pion WebRTC - WebRTC implementation
- Gorilla WebSocket - WebSocket implementation