PROBLEM:
WebRTC gives us peer-to-peer video/audio connections. It is perfect for p2p calls, hangouts. But what about broadcasting (one-to-many, for
AFAIK the only current implementation of this that is relevant and mature is Adobe Flash Player, which has supported p2p multicast for peer to peer video broadcasting since version 10.1.
http://tomkrcha.com/?p=1526.
I am working on a Relay
version of WebRTC but I am not sure if it will work. My test is just for one user Johnny
and see if that stream can be relayed
to other users.
Johnny
, the 2nd is special user Relay
local
and a remote
video element for testing.Hub
are automatically displayed in the browser window.Relay
and that user will show up in the remote
video element of the first browser window and Johnny
will show in the remote
window of the second browser window.Johnny
will have to connect to the remote
window of the special user relay
. This example is with one user but the relay
window could have more windows (RTCPeerConnections) for more users to connect.relay
browser window will be the server to other users. All users connect to the relay
browser window. RTCPeerConnections will be created for each connected user.In my example I visualize it with <video>
elements but in the relay
browser window RTCPeerConnections should be enough.
Is this Idea logic or am I missing something?
As peer1 is only the peer who invokes getUserMedia() i.e. peer1 creates a room.
This process continous as many peer gets connected to each other.
Hence, by this a single broadcast can be transfered over unlimited users without any bandwidth/ CPU usages problems.
Finally, all above contained is reference from Link.
You are describing using WebRTC with a one-to-many requirement. WebRTC is designed for peer-to-peer streaming, however there are configurations that will let you benefit from the low latency of WebRTC while delivering video to many viewers.
The trick is to not tax the streaming client with every viewer and, like you mentioned, have a "relay" media server. You can build this yourself but honestly the best solution is often to use something like Wowza's WebRTC Streaming product.
To stream efficiently from a phone you can use Wowza's GoCoder SDK but in my experience a more advanced SDK like StreamGears works best.
There are some solutions available in the market for WebRTC scalable solution. They provide low latency, scalable webrtc streaming. Here are some samples. Janus, Jitsi, Wowza, Red5pro, Ant Media Server
I am developer for Ant Media Server, we provide both community and enterprise edition including android and iOS SDK as well. Let us know if we can help you somehow.
"Scalable" broadcasting is not possible on the Internet, because the IP UDP multicasting is not allowed there. But in theory it's possible on a LAN.
The problem with Websockets is that you don't have access to RAW UDP by design and it won't be allowed.
The problem with WebRTC is that it's data channels use a form of SRTP, where each session has own encryption key. So unless somebody "invents" or an API allows a way to share one session key between all clients, the multicast is useless.