How can I stream videos from a torrent using HTML 5?

I have an HTML 5 website where I want to stream videos from a torrent server. I don’t know which client for Linux torrent to use. Can I use PHP as a torrent client?

Example:

<video src="downloder.php?file=movie.mp4" 

downloader.php will then return the mp4 file from the .torrent file.

+6
source share
4 answers

HTML5 / javascript doen't do bittorrent. You can do this with a java applet, although it seems. It seems that cue ball is working: http://www.bitlet.org/video

+2
source

You can use the fantastic @feross library, webtorrent . This works in both Node.js and the browser.

+6
source

I do not think that it is even possible to stream from a torrent. Files from the torrent are divided into small pieces, which turn out to be disordered when / if you receive them from other clients, when / if other clients decide to send them to you.

0
source

The torrent file has no data for the stream. Your PHP server will need to start receiving torrent data from other peers (this is how torrents work).

MP4 is not a format that every byte needs to play, so QuickTime can start playing before it is fully loaded (therefore, streaming), but the bytes that need to be played must be at the beginning (or at the end, but in any case) - torrents do not load in byte order. As the above user said, torrents load data into chunks. You need at least a headline.

This is just unreal.

-3
source

Source: https://habr.com/ru/post/886734/


All Articles