se-bastiaan / TorrentStream-Android

A torrent streamer library for Android based on libtorrent4j
Other
343 stars 108 forks source link

How to get interested pieces first on seeking video player forward #79

Closed meAnurag closed 2 years ago

meAnurag commented 2 years ago

Can I get to know how to make the library download first the pieces corresponding to wherever user seeks.

se-bastiaan commented 2 years ago

Sorry for the late response. Hope you can still use this answer.

Technically the only thing you have to do is call setInterestedBytes on the Torrent object. However, for that you will need to know which bytes exactly you are interested in.

Either you have a magic media player that has an intermediary layer with a file handler that knows this, or you could use TorrentStreamServer-Android. This serves the media file via HTTP to your media player and selects the interested bytes to the last requested ones. Aka, the bytes that a user is seeking to.