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

Uncaught Error: filesystem paths do not work in the browser #779

Closed
NgaNguyenDuy opened this issue Apr 29, 2016 · 2 comments
Closed

Uncaught Error: filesystem paths do not work in the browser #779

NgaNguyenDuy opened this issue Apr 29, 2016 · 2 comments
Labels

Comments

@NgaNguyenDuy
Copy link

@NgaNguyenDuy NgaNguyenDuy commented Apr 29, 2016

  • WebTorrent version: 0.91.1
  • Node.js version: v5.2.0
  • Browser name/version (if using WebTorrent in the browser): Chromium 49.0.2623.108 Built on 8.3, running on Debian 8.3 (64-bit)

I got this message when try to seed a file served from localhost via nginx: http://localhost/a.mp4. My code:

index.html

<!doctype html>
<html>

  <body>
    <input type="file" name="upload" onchange="handleFiles()" multiple>
  </body>
  <script src="webtorrent.min.js">
  </script>
  <script src="script.js"></script>
</html>

script.js

var rtcConfig = {iceServers: []};
var client = new WebTorrent({ rtcConfig: rtcConfig });
client.seed("http://localhost/a.mp4", function (torrent) {

        console.log('Web Seeding support ..' + torrent.magnetURI);
    })

I have just search in issue and find #665 but i can't any information to solve this. Pls help me.

@feross

This comment has been minimized.

Copy link
Member

@feross feross commented Apr 29, 2016

HTTP url arguments are not supported to client.seed. You should try passing in one of the other supported types.

If you insist on using an http url, then you should download the file first, if it's not too large.

var get = require('simple-get')

var client = new WebTorrent({ rtcConfig: rtcConfig })

get('http://localhost/a.mp4', function (err, res) {
  if (err) return console.error(err.message)

  var opts = {
    name: 'My cool torrent',
    urlList: [ 'http://localhost/a.mp4' ] // add a web seed to the torrent
  }

  client.seed(res, opts, function (torrent) {
    console.log('magnet link with web seed support: ' + torrent.magnetURI)
  })
})
@feross feross closed this Apr 29, 2016
@feross feross added the question label Apr 29, 2016
@lock

This comment has been minimized.

Copy link

@lock lock bot commented May 4, 2018

This thread has been automatically locked because it has not had recent activity. To discuss futher, please open a new issue.

@lock lock bot locked as resolved and limited conversation to collaborators May 4, 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.