Prerequisites
Check Go Version
Verify your Go installation:You should see output like
go version go1.24.0 or higher.Install Pion WebRTC
Using Go Modules (Recommended)
Add Pion WebRTC to your project with a single command:Important: Always specify the
/v4 suffix when importing. This ensures you get the latest v4 release.Initialize a New Project
If youβre starting a new project:Version Management
Using Specific Versions
To use a specific version of Pion WebRTC:Using v3 (Legacy)
Dependencies
Pion WebRTC automatically manages its dependencies through Go modules. Core dependencies include:Core Pion Libraries
Core Pion Libraries
- pion/datachannel (v1.6.0) - SCTP DataChannel implementation
- pion/dtls/v3 (v3.1.2) - DTLS 1.2 protocol
- pion/ice/v4 (v4.2.1) - ICE (Interactive Connectivity Establishment)
- pion/interceptor (v0.1.44) - RTP/RTCP interceptor framework
- pion/rtp (v1.10.1) - RTP packet processing
- pion/rtcp (v1.2.16) - RTCP packet processing
- pion/sctp (v1.9.2) - SCTP protocol implementation
- pion/sdp/v3 (v3.0.18) - SDP parsing and generation
- pion/srtp/v3 (v3.0.10) - SRTP encryption
Network & Transport
Network & Transport
- pion/stun/v3 (v3.1.1) - STUN protocol
- pion/turn/v4 (v4.1.4) - TURN relay protocol
- pion/transport/v4 (v4.0.1) - Network transport utilities
Utilities
Utilities
- pion/logging (v0.2.4) - Logging interface
- pion/randutil (v0.1.0) - Random number utilities
- golang.org/x/net (v0.50.0) - Network extensions
go get or go build.
Importing in Your Code
Import Pion WebRTC in your Go files:Additional Packages
Pion provides additional packages for media handling:Media Utilities
For reading and writing media files:Media Devices (Requires CGo)
For capturing audio/video from hardware devices:Platform-Specific Notes
- Linux
- macOS
- Windows
- WebAssembly
- Mobile
No additional dependencies required. Pion WebRTC works out of the box.
Verify Installation
Create a simple test file to verify your installation:Build Configuration
Optimized Builds
For production builds, use optimizations:Build Times
Performance benchmarks (on Intel Core i5-2520M @ 2.50GHz):
- Time to build examples: ~0.28 seconds
- Time to run full test suite: ~77 seconds
Troubleshooting
Import path doesn't contain a hostname
Import path doesn't contain a hostname
Make sure Go modules are enabled:
Cannot find module providing package
Cannot find module providing package
Ensure youβre using the correct import path with
/v4:Go version too old
Go version too old
Pion WebRTC v4 requires Go 1.24.0+. Upgrade Go or use v3:
Module checksum mismatch
Module checksum mismatch
Clear your module cache and retry:
Next Steps
Quick Start Guide
Build your first WebRTC application with a step-by-step tutorial
Browse Examples
Explore 30+ working examples covering common use cases
API Documentation
Dive into the complete API reference
Join Community
Get help and share your projects on Discord