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

HTTP server for streaming video #239

Closed
jakefb opened this issue Jan 7, 2015 · 1 comment
Closed

HTTP server for streaming video #239

jakefb opened this issue Jan 7, 2015 · 1 comment

Comments

@jakefb
Copy link
Contributor

@jakefb jakefb commented Jan 7, 2015

Hi,

I'm trying to write a streaming HTTP server for node that integrates as a peer, with WebTorrent. I have got this far. I'm new to node.js by the way. Is it possible to use http as a web seed, without WebRTC? This would be great as a fallback.

var http = require('http');
var fs = require('fs');
var createTorrent = require('create-torrent')
var WebTorrent = require('webtorrent')

client = new WebTorrent()

var files = 'video.mp4'

createTorrent(files, function (err, torrent) {
  if (!err) {
    // `torrent` is a Buffer with the contents of the new .torrent file
    fs.writeFile('video.torrent', torrent)

    client.add('video.torrent', function (torrent) {
            // Got torrent metadata!
            console.log('Torrent info hash:', torrent.infoHash)
        })
    }
})

http.createServer(function (req, res) {
    fs.createReadStream(files).pipe(res)
}).listen(1337, '127.0.0.1')
console.log('Server running at http://127.0.0.1:1337/')
@feross

This comment has been minimized.

Copy link
Member

@feross feross commented Jan 9, 2015

Hey @jakefb, both web seeding and node.js support for web peers are planned, but unimplemented:

  • #67 (web seeding)
  • #202 (node & command line should be a "hybrid client")

I'm hoping to get both done this month. You can follow the individual issues.

@feross feross closed this Jan 9, 2015
@lock lock bot locked as resolved and limited conversation to collaborators May 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
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.