Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / multimedia / video

WebRTC based Event Video Broadcasting to Connect with 1000 People Without the Need of Any Server

5.00/5 (1 vote)
9 Feb 2014CPOL2 min read 15K  
WebRTC based Event Video Broadcasting to connect with 1000 people without the need of any server

Well I have been thinking about a video broadcasting system where we won't need any Media Server. 

I believe the idea is - A captures the live video/audio event. When B comes to a certain chat-room and connects with A, A relays it to B, and when C comes to the same room (or same page), C connects with the latest user B and B relays the video received from A to C.. and like wise C->D->E->F... creating a chain of viewers where at most 2 communication channels have to be sustained by each viewer. I think RCTPeerConnection takes a media stream, so instead of the local stream somehow if the remote stream received by B from A can be used while B is trying to make connection to C - it should be possible.

Image 1

I think I have managed to relay A's video to C. Since I am testing with only one PC (laptop) and two different cameras, I am not 100% certain, but I think I have done it, it seems RTCPeerconnection is able to take a remote stream. Btw, I am using the easyrtc library since I can't find any workable simple codes to test with. So the basic idea should be, A grabs the event video. B connects to A, B saves the remote stream reference received from A; C connects to B, B instead of passing local media stream, hands the remote media stream to C; C would save that remote media stream; When D connects to C, C would hand the remote media stream received from B (which actually has been received originally from A) to D and like wise, the flow continues... i.e., A's media stream passes like a Wave through B, C, D , E.... Notice that the connection flow should look like this: A<-->B<-->C<-->D<-->E... every node has only two connection.. with the previous node and the next node. However, long story short - Yes, you can access the media stream and hand it to another remote connection, I just need an expert who can give me a working raw JS based webrtc code where A connects with B and vice versa.. and I would try to write C connecting with B and D connecting with C codes for proper testing.

hint: 
login as "guest", with password: "thanks" to post comments

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)