11

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.

Trevor
  • 1,369
  • 2
  • 13
  • 28

1 Answers1

25

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

Jeremy
  • 1,308
  • 10
  • 11
  • 5
    While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - [From Review](/review/low-quality-posts/18958339) – Maximilian Peters Feb 28 '18 at 09:00
  • 2
    Could you expand on how my answer could be further improved please? – Jeremy Mar 04 '18 at 23:56
  • 1
    The real issue here is the question, not the answer. If someones asks for a library (which is not within the scope of SO's questions), the correct answer is a link to a library. But in general answers should work even without the link, i.e. a code snippet with a link to the original source or documentation would be fine. – Maximilian Peters Mar 05 '18 at 08:23
  • @maximillian I disagree in this case as the question was generic. Might not be SO policy indeed however. – WJA Jul 22 '19 at 17:23
  • I'd like to know @jeremy, you claim you put this together but yet you forked it from the aiortc GitHub repo... How are you claiming it to something you put together? – Jamie Lindsey Feb 27 '20 at 02:18
  • 2
    @jamie check the commit history, I am the author. I moved the aiortc repo to an organization some time ago as there are several related repos (pylibsrtp, aioice). I have updated the link in my answer. – Jeremy Feb 28 '20 at 06:43
  • My bad, I should've looked before commenting.. excellent work mate! – Jamie Lindsey Feb 28 '20 at 10:11