popcorn-official / popcorn-android

Popcorn Time is a multi-platform, free software BitTorrent client that includes an integrated media player ( Android / AndroidTV ) A Butter-Project Fork
https://popcorn-time.site
Other
1.22k stars 274 forks source link

Download of content for offline viewing #514

Closed SscSPs closed 2 years ago

SscSPs commented 5 years ago

Can we provide a "Download" option for content that would be openable in popcorn time only(or not, can have an export option as well) for viewing later? kinda like what other services provide with download option? I'm willing to work on it, so I just wanted to know if you guys would be willing to take PR/suggestions for this topic?

MrRory commented 5 years ago

Depends on the implementation. It's not easy because the torrent library we use is specifically made for sequential downloading one single file. That's why every piece of content has a magnet button, tapping it opens an installed torrent client.

SscSPs commented 5 years ago

well, I was thinking to implement it using that magnet itself, we can just stream the torrent(or download the file, sequentially) and instead of sending the output stream to the video player, we can send it to a file on disk, then when we need to play that video, we can just pipe that file's content to the video player. (Obviously since the current lib is for sequential downloads, this wont be the fastest download, but something is better than nothing). I havent checked the current implementation of video data being provided to player to be played, but it shouldn't be hard to just reroute it to different place and save it for offline usage.

SscSPs commented 5 years ago

I'll be looking into how its implemented soon and will try to do it, do you have any recomendation/guidelines for where the "Downloads" section should be?

  1. A new item in nav bar,
  2. A new tab on sort pages(movie/tvshows/anime)

I'm thinking 2 will be better, but that'll be more scattered than 1st one. Please provide any thoughts that you may have.

MrRory commented 5 years ago

well, I was thinking to implement it using that magnet itself, we can just stream the torrent(or download the file, sequentially) and instead of sending the output stream to the video player, we can send it to a file on disk, then when we need to play that video, we can just pipe that file's content to the video player.

Then you don't need to do anything, since the file is already there. 'Streaming' is sequential download to a file that is served by a HTTP server which provides a stream for local and chromecast playback.

If you want content for offline viewing it should work flawlessly with multiple downloads, that's where TorrentStream fails to provide the right implementation. Having a good torrent client that works without problems would be required, a half baked solution is not something I want to merge.

SscSPs commented 5 years ago

Okay, thanks for the input, I'll look for how I can manage multiple simultanious downloads. will be trying out my single download solution by myself, and will update forther for how it goes.

camiloforero commented 5 years ago

The getpopcorntime fork has video download available. Is it possible to ask for their source code and see how they did it?