by hootener · 11y ago · 0 comments
I'd love to see WebRTC done by a service provider in a highly scalable way, so I can stop relying on RTMP (and typically embedding a flash player to support it) to deliver live streaming audio/video on a large scale.
As someone who has only leveraged WebRTC through third party providers (e.g., OpenTOK, etc.), I have no idea the complexity of what I'm asking for. Perhaps it's boil the ocean difficult, but it sure would be nice to have!
Here was my basic approach:
An end user creates a PeerConnection with a Publisher node and starts sending a MediaStream using a string identifier.
Then another user can create a PeerConnection with a Subscriber node using the same identifier.
The Subscriber node then makes a request to the Publisher to make another PeerConnection to a Registry that exists on the same node as the Subscriber.
The replicated MediaStream can then be attached to the Subscriber.
Since the replicated MediaStream is in a Registry, any additional subscribers can attach the MediaStream on the same node as well.
The code is a huge mess but it is here (The scala server is in the media directory): https://github.com/jgrowl/livehq
There is a vagrant file that brings up the whole system at the root of the project (using docker). I have not tested it recently on anything other than ubuntu.
Unfortunately, until IE and Safari support WebRTC, then RTMP is really still the best way to do low-latency streaming and video chat in the browser. Additionally, most RTMP server software will scale out to hundreds of clients out of the box.