Inspiration
I got in contact with P2PSP organisation while applying for Google Summer of Code, the previous year(2017). My mentors had just an idea and the project wasn't started. Fortunately, I was selected alone to work on this project. It was very difficult in the beginning, since I hadn't worked on WebRTC for long and this introduced me to my steepest learning curve. Things started working out and at the end of summers after all the ups and downs, Virtual room was ready.
What it does
- Real-Time Video Sharing Share videos with your family and friends in a synchronized way at the same time that you keep a video-call with them. It's like watching your favorite videos in the same room but virtually.
- Peer-to-Peer connection Data is shared directly among browsers without passing through a server.
- In browser MP4 fragmentation
- Cuting edge technologies Technologies used are P2PSP, WebRTC and MSE
How I built it
Made a clean UI and set up the virtual room and home page. Added elements to be generated dynamically whenever a new peer is added(a new connection is established). Made a websocket as a signalling server to handle the session descriptions and ice candidates. I used WebRTC library to have a peer to peer connection(browser to browser) and python to make the signalling server. It accepts the video file from local system, divided it into chunks and using a round robin scheduling method, distributes the packets amongst a mesh network. getUserMedia was used to communicate the user video and audio simultaneously. Signalling server was also used to signal the notifications and synchronise the playback.
Challenges I ran into
The main challenge was the USP of the application. No application I came across allows users to stream a video file from their local file system synchronously while they video conference simultaneously. Dividing the video into a bunch of chunks wouldn't work, I had to fragment the MP4 video in the browser itself, divide them into chunks by calculating the file of size and number of peers and then send it through a round robin method, collect and map all the chunks on every client in the room and then re rendering again on their screens. This whole part was the most challenging but the most unique and fun as well.
Accomplishments that I'm proud of
Generally broadcasting applications(small ones) don't think about scalability and end up making a bottleneck on the master client. Say, in our example master client is the client who has the video file, they would prefer the client to send all the chunks to all the users all by himself. This would be unfair to the master client as well as would definitely generate congestion in the network. I made a mesh network in which every chunk was assigned a number and by the round robin scheduling method, each chunk was sent only to one client which was further distributed to all other clients. This meant every client would send the same number of chunks(in most of the cases)
What I learned
I had a really deep dive in WebRTC and Media source extensions. I had a vision of how I could leverage the media in the age of WebRTC. I learnt a lot about peer to peer communication, their protocols, data channels. In order to make the application more scalable I dived into core concepts of networking, different topologies, how they work, how to control congestion. I learnt about TCP and UDP and what to use when, how to make the application fault tolerant i.e. regularising the loss of packets.
What's next for Virtual Room
I had a numerous features in mind to make this project the new revolutionary utility tool. This is the best thing about Virtual-room, it can be used for entertainment as well as utility in many domains. I thought of integrating a realtime whiteboard(The whiteboard is ready but hadn't integrated it yet) which would help a lot for ideation for literally anything, a new product for teaching utility making it a virtual and interactive classroom. Have a real time code editor, this way programmers can collaborate while they video conference. Multi utilities such as, showing a presentation and collaborating on whiteboard or code editor in real time. This could improve the way we interact with people socially and professionally as well.
Log in or sign up for Devpost to join the conversation.