webrtc-java is a Java wrapper for the WebRTC Native API, providing similar functionality to the W3C JavaScript API. It allows Java developers to build real-time communication applications for desktop platforms without having to work directly with native code.
The library provides a comprehensive set of Java classes that map to the WebRTC C++ API, making it possible to establish peer-to-peer connections, transmit audio and video, share screens, and exchange arbitrary data between applications.
Calls and data
- Client API - High-level calls that negotiate by themselves, keep your code off WebRTC's threads and close with one call
- WHIP and WHEP - Publish to and play from streaming servers
- Peer connections - The full native API, modeled on the W3C JavaScript API
- Data channels - Reliable or unreliable peer-to-peer messaging
- Statistics - Detailed metrics on connection quality
Audio and video
- Cameras and microphones - Capture from any local device
- Screen sharing - Share the full desktop or single application windows
- Video processing - Blur a background, draw an overlay or blank out part of the screen before frames are sent
- Video views - Ready-made components that show video in Swing, or in JavaFX with the
webrtc-java-javafxmodule
Codecs and encoded media
- Hardware codecs - H.264, H.265, VP9 and AV1 on the GPU with NVENC/NVDEC, Media Foundation, VA-API and VideoToolbox, falling back to software
- Custom codecs - Plug in video encoders and decoders written in Java, or limit the codecs a factory offers
- End-to-end encryption - Read, change or drop encoded audio and video frames, like insertable streams in the browser
- Pre-encoded media - Send a camera's H.264 stream or a recording without re-encoding it
Optional modules
- Media playback (
webrtc-java-media) - Stream video and audio files or RTSP sources into a call, decoded with FFmpeg - Call recording (
webrtc-java-media) - Save what a call sends or receives into MKV, WebM or MP4 files, without re-encoding
Platforms
Prebuilt native libraries behind a thin JNI layer:
| OS | x64 | arm64 | arm32 |
|---|---|---|---|
| Windows | ✓ | ✓ | |
| macOS | ✓ | ✓ | |
| Linux | ✓ | ✓ | ✓ |
For more detailed information, check out the documentation:
- Quickstart - Get up and running quickly with webrtc-java
- Guides - Comprehensive documentation on using the library
- Examples - Sample code demonstrating various features
- Build Notes - Instructions for building the library from source
- Unreleased Docs - Documentation of the main branch, including features not released yet
Copyright (c) 2019-2026 Alex Andres
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
