WebRTC - scalable live stream broadcasting / multicasting

前端 未结 12 706
别跟我提以往
别跟我提以往 2020-11-30 16:47

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

相关标签:
12条回答
  • 2020-11-30 17:15

    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.

    0 讨论(0)
  • 2020-11-30 17:15

    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.

    1. We have two browser windows open. The first is user Johnny, the 2nd is special user Relay
    2. In the display you will have a local and a remote video element for testing.
    3. When start browsing the connected users to the Hub are automatically displayed in the browser window.
    4. Click in the first window on user 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.
    5. Now comes the big trick all other users that want to connect to 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.
    6. The 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?

    0 讨论(0)
  • 2020-11-30 17:20

    As peer1 is only the peer who invokes getUserMedia() i.e. peer1 creates a room.

    1. So, peer1 captures media and starts room.
    2. peer2 joins the room and get stream(data) from peer1 and also open parallel connection named as "peer2-connection"
    3. When peer3 joins the room and get stream(data) from peer2 and also open parallel connection named as 'peer3-connection" and so on.

    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.

    0 讨论(0)
  • 2020-11-30 17:21

    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.

    0 讨论(0)
  • 2020-11-30 17:22

    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.

    0 讨论(0)
  • 2020-11-30 17:26

    "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.

    0 讨论(0)
提交回复
热议问题