Open vankasteelj opened 7 years ago
from my quick tests, webtorrent doesn't seem to want to run in a worker.
i think @jaruba implemented something like that ?
I did that with peerflix, not webtorrent, which doesn't need window and I only pass the magnet link to the worker
you pass the magnet and get back the localhost url? yes that's what I wanted to do, but as I said, window is needed :/ Maybe checking with webtorrent directly. I vaguely remember reading an issue about it
In my PR (https://github.com/popcorn-official/popcorn-desktop/pull/474) I was able to fork a process and start up webtorrent there. I think instead of https://github.com/butterproject/butter-desktop/blob/master/src/app/lib/streamer.js#L285 resolving a url, the message passed back to the main thread can be the url. This way the UI (main thread) isn't locked up.
e.g.
this.worker.on('message', function(msg) {
if(msg.action === 'url') {
// creates the <video> here where the window DOM is present.
this.waitForBuffer(msg.payload);
}
}.bind(this));
I was able to make a branch that did the following:
Noticeable:
it's #607
let's spin up on init, after all we are a torrent streaming app, and we're going to use that for updater anyway. i'm not sure if we should spawn 1 webtorrent and add all to it, or spawn a worker by 'task', the second is probably easier to manage but heavier.
streamInfo should be split, no doubt about that !
delays in streaminfo reporting are not an issue, we should probably throttle updates though.
looks good to me =)
awesome ! i'm not sure though if we want many webtorrents or one that handles all. i guess the first is easier to manage while the second will require a registery.
Such as webtorrent, for example. Although we might be limited to webrtc connexions, which would be bad.