简体   繁体   中英

How does seek work in peerflix?

i was checking peerflix and it was really awesome that it support seek feature in videos. i tried to understand how it works , i think it create a stream pipe on HTTP file server and write video data on it when a required piece is downloaded and the video player reads data from other end of pipe. i tried to do this in java using Pipedinputstream and pipedoutputstream using nanohttpd server but cannot make it work. is there something i am missing?

peerflix: it is a lib that stream torrent videos , you can watch videos with seek feature. you do not have to wait for the download to finish.

Peerflix selects the biggest file in the torrent or you can select one on your own. Then it begins downloading the file sequentially from the first piece. This file is served on a standard HTTP static file server.
When you seek in a video player, it checks the video container to find which bytes in the video file that corresponds to the given time stamp. The video player then sends a HTTP range request for the bytes corresponding to the video time plus some buffer. Then, Peerflix's HTTP server reads this range request and checks the .torrent file to find which piece corresponds to the requested bytes. It starts downloading sequentially from the requested piece onwards, and responds to the HTTP request when the requested bytes are available.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM