- Notifications
You must be signed in to change notification settings - Fork797
WebRTC and ORTC implementation for Python using asyncio
License
aiortc/aiortc
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
aiortc
is a library forWeb Real-Time Communication (WebRTC) andObject Real-Time Communication (ORTC) in Python. It is built on top ofasyncio
, Python's standard asynchronous I/O framework.
The API closely follows its Javascript counterpart while using pythonicconstructs:
- promises are replaced by coroutines
- events are emitted using
pyee.EventEmitter
To learn more aboutaiortc
pleaseread the documentation.
The main WebRTC and ORTC implementations are either built into web browsers,or come in the form of native code. While they are extensively battle tested,their internals are complex and they do not provide Python bindings.Furthermore they are tightly coupled to a media stack, making it hard to plugin audio or video processing algorithms.
In contrast, theaiortc
implementation is fairly simple and readable. Assuch it is a good starting point for programmers wishing to understand howWebRTC works or tinker with its internals. It is also easy to create innovativeproducts by leveraging the extensive modules available in the Python ecosystem.For instance you can build a full server handling both signaling and datachannels or apply computer vision algorithms to video frames using OpenCV.
Furthermore, a lot of effort has gone into writing an extensive test suite fortheaiortc
code to ensure best-in-class code quality.
aiortc
allows you to exchange audio, video and data channels andinteroperability is regularly tested against both Chrome and Firefox. Here aresome of its features:
- SDP generation / parsing
- Interactive Connectivity Establishment, with half-trickle and mDNS support
- DTLS key and certificate generation
- DTLS handshake, encryption / decryption (for SCTP)
- SRTP keying, encryption and decryption for RTP and RTCP
- Pure Python SCTP implementation
- Data Channels
- Sending and receiving audio (Opus / PCMU / PCMA)
- Sending and receiving video (VP8 / H.264)
- Bundling audio / video / data channels
- RTCP reports, including NACK / PLI to recover from packet loss
The easiest way to installaiortc
is to run:
pip install aiortc
If there are no wheels for your system or if you wish to build aiortc fromsource you will need a couple of libraries installed on your system:
- Opus for audio encoding / decoding
- LibVPX for video encoding / decoding
On Debian/Ubuntu run:
apt install libopus-dev libvpx-dev
On OS X run:
brew install opus libvpx
aiortc
is released under theBSD license.
About
WebRTC and ORTC implementation for Python using asyncio