Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WebRTC Python implementation

Tags:

python

webrtc

Is there an implementation of RTCPeerConnection in Python? I have a Python app that is going to act as a peer in a video sharing app (other peer is a browser). There's plenty of examples of signaling servers in Python but I can't find any implementations of RTCPeerConnection itself. I do not want to use something like PyQt and webkit, etc.

like image 529
Trevor Avatar asked Feb 22 '18 17:02

Trevor


People also ask

Can I use WebRTC in Python?

WebRTC is an open-source project providing peer-to-peer, real-time communication capabilities to web browsers, mobile devices, and any other device that can run code using the available APIs for Javascript, Python, . NET, Golang, and more.

What is 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.

What is WebRTC and how does it work?

The "WebRTC" (Web Real-Time Communication) is an open-source protocol that allows real-time communication and data sharing between different browsers and devices. It allows sharing of voice, video, and data over the web. It is a protocol that sets two-way communication between two browsers in real-time.


1 Answers

You are right in stating that most examples on the web related to WebRTC / Python only use Python for signaling.

I believe one reason for the lack of a Python-based WebRTC implementation so far was that WebRTC is a fairly complex stack involving SDP negotiation, Interactive Connectivity Establishment to find a path between two peers, DTLS handshake + SRTP encryption, all this happening in an asynchronous fashion.

With the availability of asyncio however, the picture has changed somewhat, as it is now possible to write asynchronous code in a more linear fashion, without resorting to callbacks.

As a result, I have put together an asyncio-based WebRTC implementation for Python which I believe will fit nicely with the usecase you describe:

https://github.com/aiortc/aiortc

like image 195
Jeremy Avatar answered Nov 15 '22 16:11

Jeremy