Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Client-side only video solution? #1808

Open
anderspitman opened this issue Jan 20, 2020 · 7 comments
Open

Client-side only video solution? #1808

anderspitman opened this issue Jan 20, 2020 · 7 comments

Comments

@anderspitman
Copy link

@anderspitman anderspitman commented Jan 20, 2020

I read through several similar issues, but didn't find a conclusive answer to my question. Sorry if I missed it somewhere.

My goal is to host my own videos on my HTTP server. Most of the time I don't expect many people to be viewing them, but I would expect large spikes once in a while, and I want to handle those with p2p. If possible, I don't want to implement any special logic on the server.

The ideal client-side algorithm would go something like this:

  1. Start streaming the video over HTTP immediately upon connection.

  2. Connect webtorrent and check if there is a torrent for this video.

  3. If there is a torrent, check if there are any peers.

  4. To the extent possibly, start pulling chunks from peers instead of HTTP.

  5. Start seeding.

The final solution will need to work with both single-file mp4/h264/aac videos, and HLS (including fmp4).

Is there anything that currently does this? If not, I'd be interested in building it. Are there technical limitations I'm missing that would make it impossible?

@anderspitman anderspitman changed the title Client-side video solution? Client-side only video solution? Jan 20, 2020
@ibinti

This comment has been minimized.

Copy link

@ibinti ibinti commented Jan 21, 2020

what is the max size of your video?

@anderspitman

This comment has been minimized.

Copy link
Author

@anderspitman anderspitman commented Jan 21, 2020

Probably pretty big. There will be practical limitations of storage space and max bitrates, but I'd say at least 4 hours at ~20Mbps. Obviously with HLS the effective streaming bitrate could be a lot lower.

@ibinti

This comment has been minimized.

Copy link

@ibinti ibinti commented Jan 22, 2020

then there is an existing issue: Implement storage in browser clients #86
also there is an extra problem to implement readable-stream for the indexeddb, etc.
it seems that current browser webtorrent magic is all done in the memory.
so size matters at the moment.

@anderspitman

This comment has been minimized.

Copy link
Author

@anderspitman anderspitman commented Jan 22, 2020

But that's only if you try to download the entire video at once right? Would it be possible to have clients download/seed chunks within say 100MB of where that client is in the video?

@ibinti

This comment has been minimized.

Copy link

@ibinti ibinti commented Feb 1, 2020

any progress? from my research so far, it appears that webtorrent needs the whole file in order to seed due to the limit of underlying bittorrent protocol. there are some discussions else where for the chunks torrenting, but stream playing those chunks is another matter that needs to be solved as well

@ibinti

This comment has been minimized.

Copy link

@ibinti ibinti commented Feb 1, 2020

i tried to solve #86, and was able to use pouchdb to replace memory-chunk-store. so webtorrent saves chunks to indexeddb directly. but i faced unexpected memory and callback issues with immediate-chunk-store and chunk-store-stream.

@anderspitman

This comment has been minimized.

Copy link
Author

@anderspitman anderspitman commented Feb 2, 2020

@ibinti I haven't been working on it. Probably still at least a few months before I'll seriously dig into solving this. Using HLS videos might mitigate this somewhat, but using a separate torrent for each chunk. Not sure if that would work very well or not. Might be too much overhead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.