A virtual room where friends share videos among them in real time directly over the web browser, with synchronized playback and a video chat at the same time.It's like to watch your favorite videos in the same room but virtually. The video stream content is not passed through the server maintaining the anonymity of the peers. The project is built on Peer to Peer Straight Forward Protocol enabling the browser to browser connection for peers. The MP4 video is fragmented in the browser itself rather than using external softwares.
The project is built on Media Source Extenesions, WebRTC and P2PSP. The UI is built with the help of Materialize. Python is used to write websockets and hence the signalling server.
The project was developed from scratch this summers, although my mentors had made a couple of experiments on the same idea before. The UI of the room was built in the very initial days of the coding period. I faced my first challenge just after this, fragmenting the MP4 video in the broswer was a crucial feature of the application, which took me some time to go through using MP4Box. I then went with initializing peer connections using WebRTC. The connection halted for a while since I had to write the signalling server first to exchange information of peers like sdp and more. I then proceeded with processing the raw chunks from fragmentation to a typed array with the chunk numbers for a smooth transmission. I first wrote a test server in django to properly test the application and then focused on making multiple peer connections and setting up data channels to transmit content amongst peers after a suceessful connection. There were some issues with the source buffer due to memory and chunk number which got resolved quickly. According to the DBS implementation of P2PSP, I implemented round robin scheduling of chunks and synchronized playback of the content amongst peers which was a bit challenging. After fixing a couple of issues with multiple peer connections and streaming, I took off to implement teh video conference feature. This made a barrier as some of the WebRTC API such as addTrack
and more were not supported by multiple browsers, this created conflict with other APIs, which was resolved by adapter.js
. The video conference was still not stable till now, my mentors suggested to shift the testing server on php for now as it was much simpler and decreased redundancy. For video conference I also made features like fallback option if the webcam is not available and a couple of webcam controls which were suggested later by the mentors. Added an option of optional alias for the peers. The project was almost complete by this time as I was still squashing some bugs in the application. Properly refactored the code and wrote a documentation which could help all the developers in the future(including me) to work upon the project smoothly.