DEV Community

loading...
Cover image for Watchit - Streaming Mechanisms

Watchit - Streaming Mechanisms

Geolffrey Mena
Programming lover
・3 min read

Hello guys, in our previous post we showed a general idea about a proof of concepts of a decentralized movies playback system. In short, it allows you to see the movies that other people share with you and that you also share with them.

If you read our previous post and tried the app, you will know that the initial version of Watchit is a desktop version, which by its nature has its limitations. To expand access to our dapp and mitigate some of these limitations, we have faced the challenge of adapting Watchit to different platforms, which brought us new challenges.

To get into context we can say that for all this magic of watching a movie on our screen to be possible; Either from a "centralized" medium or from a "decentralized" medium, streaming mechanisms are needed or, say, transmission/distribution of multimedia content without interruption for the dissemination of audio/video read more.

Watchit is no exception and since we are a decentralized application we must also maintain our decentralized streaming mechanisms, among these are HLS and Torrent.

Among one of the challenges we have encountered has been the interoperability of the Torrent streaming mechanism. In a brief technical summary, the problem is that the nodes of the desktop environment use the TCP/uTP protocols as transport, which cannot connect directly with the web nodes, which in turn communicate through webRtc. In simple words it is like wanting to send an "iMessage" and someone to reply with a “Regular SMS", in a certain way they are different communication signals and therefore they are not compatible.

In order to overcome the threshold we have elaborated a small bridge to connect these two "islands" (webtorrent <=> bittorrent), here is a small diagram of the proposed architecture:

Captura de pantalla de 2021-05-05 16-36-07

Notes:

  1. When a "movie" is played on the worker nodes, it serves as a seed for the other nodes including the web nodes.
  2. When no one is playing the "movie" and a web node try to watch it (wink;wink) then a broadcasting signal "seeding" request is sent to all the worker nodes that helps as bridge for wrtc network streaming.
  3. The worker node must accept be a seeder otherwise seed request it denied.

HLS (HTTP Live Streaming) is another streaming mechanism supported by Watchit and that, unlike torrent streaming, does not require such a complex architecture. The simplicity that exists in this mechanism in terms of interoperability can be seen in the graph below:

Captura de pantalla de 2021-05-05 19-37-52

In the alpha implementation of webtorrent architecture, web nodes can play only "movies" being played at the same time on a desktop node.

References

More info:

Special thanks to @aphelionz, @brokoli and @mistakia for their contributions to this article.

Discussion (0)