Aiortc
aiortc is a library for Web Real-Time Communication (WebRTC) and Object Real-Time Communication (ORTC) in Python. It is built on top of asyncio, Python's standard asynchronous I/O framework.
The API closely follows its Javascript counterpart while using pythonic constructs:
- promises are replaced by coroutines
- events are emitted using pyee.EventEmitter
To learn more about aiortc please read the documentation.
Test TURN Server
import asyncio
import aiortc
from aiortc import RTCIceCandidate, RTCIceServer, RTCIceGatherer, RTCIceTransport
async def main():
server = RTCIceServer(urls="turn:demo.yourserver.com:3478")
test = RTCIceGatherer([server])
await test.gather()
print(test.state)
print(test.getLocalCandidates())
loop = asyncio.get_event_loop()
result = loop.run_until_complete(main())
Troubleshooting
AttributeError: 'builtins.Certificate' object has no attribute '_x509'
Pyca/cryptography#AttributeError: 'builtins.Certificate' object has no attribute '_x509' 항목 참조.